| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | //-------------------------------------------------------- | ||
| 2 | // Zelda Classic | ||
| 3 | // by Jeremy Craner, 1999-2000 | ||
| 4 | // | ||
| 5 | // qst.cc | ||
| 6 | // | ||
| 7 | // Code for loading '.qst' files in ZC and ZQuest. | ||
| 8 | // | ||
| 9 | //-------------------------------------------------------- | ||
| 10 | |||
| 11 | #ifndef __GTHREAD_HIDE_WIN32API | ||
| 12 | #define __GTHREAD_HIDE_WIN32API 1 | ||
| 13 | #endif //prevent indirectly including windows.h | ||
| 14 | |||
| 15 | #include "precompiled.h" //always first | ||
| 16 | |||
| 17 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | #include <stdio.h> |
| 18 | #include <string.h> | ||
| 19 | #include <string> | ||
| 20 | #include <map> | ||
| 21 | #include <vector> | ||
| 22 | #include <assert.h> | ||
| 23 | |||
| 24 | |||
| 25 | #include "metadata/sigs/devsig.h.sig" | ||
| 26 | #include "metadata/sigs/compilersig.h.sig" | ||
| 27 | #include "metadata/versionsig.h" | ||
| 28 | #include "base/zc_alleg.h" | ||
| 29 | #include "base/zdefs.h" | ||
| 30 | #include "base/colors.h" | ||
| 31 | #include "tiles.h" | ||
| 32 | #include "base/zsys.h" | ||
| 33 | #include "qst.h" | ||
| 34 | //#include "zquest.h" | ||
| 35 | #include "defdata.h" | ||
| 36 | #include "subscr.h" | ||
| 37 | #include "font.h" | ||
| 38 | #include "zc_custom.h" | ||
| 39 | #include "sfx.h" | ||
| 40 | #include "md5.h" | ||
| 41 | #include "ffscript.h" | ||
| 42 | #include "particles.h" | ||
| 43 | #include "dialog/alert.h" | ||
| 44 | //FFScript FFCore; | ||
| 45 | extern FFScript FFCore; | ||
| 46 | extern ZModule zcm; | ||
| 47 | extern zcmodule moduledata; | ||
| 48 | extern uint8_t __isZQuest; | ||
| 49 | extern sprite_list guys, items, Ewpns, Lwpns, Sitems, chainlinks, decorations; | ||
| 50 | extern particle_list particles; | ||
| 51 | extern void setZScriptVersion(int32_t s_version); | ||
| 52 | //FFSCript FFEngine; | ||
| 53 | |||
| 54 | int32_t temp_ffscript_version = 0; | ||
| 55 | static bool read_ext_zinfo = false, read_zinfo = false; | ||
| 56 | static bool loadquest_report = false; | ||
| 57 | static char const* loading_qst_name = NULL; | ||
| 58 | static byte loading_qst_num = 0; | ||
| 59 | |||
| 60 | #ifdef _MSC_VER | ||
| 61 | #define strncasecmp _strnicmp | ||
| 62 | #endif | ||
| 63 | |||
| 64 | #ifndef _AL_MALLOC | ||
| 65 | #define _AL_MALLOC(a) _al_malloc(a) | ||
| 66 | #define _AL_FREE(a) _al_free(a) | ||
| 67 | #endif | ||
| 68 | |||
| 69 | using std::string; | ||
| 70 | using std::pair; | ||
| 71 | |||
| 72 | // extern bool debug; | ||
| 73 | extern int32_t hero_animation_speed; //lower is faster animation | ||
| 74 | extern std::vector<mapscr> TheMaps; | ||
| 75 | extern zcmap *ZCMaps; | ||
| 76 | extern MsgStr *MsgStrings; | ||
| 77 | extern DoorComboSet *DoorComboSets; | ||
| 78 | extern dmap *DMaps; | ||
| 79 | extern newcombo *combobuf; | ||
| 80 | extern byte *colordata; | ||
| 81 | //extern byte *tilebuf; | ||
| 82 | extern tiledata *newtilebuf; | ||
| 83 | extern byte *trashbuf; | ||
| 84 | extern itemdata *itemsbuf; | ||
| 85 | extern wpndata *wpnsbuf; | ||
| 86 | extern comboclass *combo_class_buf; | ||
| 87 | extern guydata *guysbuf; | ||
| 88 | extern ZCHEATS zcheats; | ||
| 89 | extern zinitdata zinit; | ||
| 90 | extern char palnames[MAXLEVELS][17]; | ||
| 91 | extern int32_t memrequested; | ||
| 92 | extern char *byte_conversion(int32_t number, int32_t format); | ||
| 93 | extern char *byte_conversion2(int32_t number1, int32_t number2, int32_t format1, int32_t format2); | ||
| 94 | 14 | string zScript; | |
| 95 | 14 | std::map<int32_t, script_slot_data > ffcmap; | |
| 96 | 14 | std::map<int32_t, script_slot_data > globalmap; | |
| 97 | 14 | std::map<int32_t, script_slot_data > genericmap; | |
| 98 | 14 | std::map<int32_t, script_slot_data > itemmap; | |
| 99 | 14 | std::map<int32_t, script_slot_data > npcmap; | |
| 100 | 14 | std::map<int32_t, script_slot_data > ewpnmap; | |
| 101 |
0/2✗ Branch 0 not taken.
✗ Branch 1 not taken.
|
14 | std::map<int32_t, script_slot_data > lwpnmap; |
| 102 | 14 | std::map<int32_t, script_slot_data > playermap; | |
| 103 | 14 | std::map<int32_t, script_slot_data > dmapmap; | |
| 104 | 14 | std::map<int32_t, script_slot_data > screenmap; | |
| 105 | 14 | std::map<int32_t, script_slot_data > itemspritemap; | |
| 106 | 14 | std::map<int32_t, script_slot_data > comboscriptmap; | |
| 107 | void free_newtilebuf(); | ||
| 108 | bool combosread=false; | ||
| 109 | bool mapsread=false; | ||
| 110 | bool fixffcs=false; | ||
| 111 | bool fixpolsvoice=false; | ||
| 112 | |||
| 113 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | const std::string script_slot_data::DEFAULT_FORMAT = "%s %s"; |
| 114 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | const std::string script_slot_data::INVALID_FORMAT = "%s --%s"; |
| 115 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | const std::string script_slot_data::DISASSEMBLED_FORMAT = "%s ++%s"; |
| 116 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | const std::string script_slot_data::ZASM_FORMAT = "%s ==%s"; |
| 117 | |||
| 118 | char qstdat_string[2048] = { 0 }; | ||
| 119 | |||
| 120 | static zinfo* load_tmp_zi = NULL; | ||
| 121 | |||
| 122 | int32_t memDBGwatch[8]= {0,0,0,0,0,0,0,0}; //So I can monitor memory crap | ||
| 123 | const byte clavio[9]={97,109,111,110,103,117,115,0}; | ||
| 124 | |||
| 125 | //enum { qe_OK, qe_notfound, qe_invalid, qe_version, qe_obsolete, | ||
| 126 | // qe_missing, qe_internal, qe_pwd, qe_match, qe_minver }; | ||
| 127 | |||
| 128 | extern combo_alias combo_aliases[MAXCOMBOALIASES]; | ||
| 129 | extern combo_pool combo_pools[MAXCOMBOPOOLS]; | ||
| 130 | const char *qst_error[] = | ||
| 131 | { | ||
| 132 | "OK","File not found","Invalid quest file", | ||
| 133 | "Version not supported","Obsolete version", | ||
| 134 | "Missing new data" , /* but let it pass in ZQuest */ | ||
| 135 | "Internal error occurred", "Invalid password", | ||
| 136 | "Doesn't match saved game", "Save file is for older version of quest; please start new save", | ||
| 137 | "Out of memory", "File Debug Mode", "Canceled", "", "No quest assigned" | ||
| 138 | }; | ||
| 139 | |||
| 140 | //for legacy quests -DD | ||
| 141 | enum { ssiBOMB, ssiSWORD, ssiSHIELD, ssiCANDLE, ssiLETTER, ssiPOTION, ssiLETTERPOTION, ssiBOW, ssiARROW, ssiBOWANDARROW, ssiBAIT, ssiRING, ssiBRACELET, ssiMAP, | ||
| 142 | ssiCOMPASS, ssiBOSSKEY, ssiMAGICKEY, ssiBRANG, ssiWAND, ssiRAFT, ssiLADDER, ssiWHISTLE, ssiBOOK, ssiWALLET, ssiSBOMB, ssiHCPIECE, ssiAMULET, ssiFLIPPERS, | ||
| 143 | ssiHOOKSHOT, ssiLENS, ssiHAMMER, ssiBOOTS, ssiDINSFIRE, ssiFARORESWIND, ssiNAYRUSLOVE, ssiQUIVER, ssiBOMBBAG, ssiCBYRNA, ssiROCS, ssiHOVERBOOTS, | ||
| 144 | ssiSPINSCROLL, ssiCROSSSCROLL, ssiQUAKESCROLL, ssiWHISPRING, ssiCHARGERING, ssiPERILSCROLL, ssiWEALTHMEDAL, ssiHEARTRING, ssiMAGICRING, ssiSPINSCROLL2, | ||
| 145 | ssiQUAKESCROLL2, ssiAGONY, ssiSTOMPBOOTS, ssiWHIMSICALRING, ssiPERILRING, ssiMAX | ||
| 146 | }; | ||
| 147 | |||
| 148 | static byte deprecated_rules[QUESTRULES_NEW_SIZE]; | ||
| 149 | |||
| 150 | |||
| 151 | ✗ | void delete_combo_aliases() | |
| 152 | { | ||
| 153 | ✗ | for(int32_t j(0); j<256; j++) | |
| 154 | { | ||
| 155 | ✗ | if(combo_aliases[j].combos != NULL) | |
| 156 | { | ||
| 157 | ✗ | delete[] combo_aliases[j].combos; | |
| 158 | ✗ | combo_aliases[j].combos=NULL; | |
| 159 | } | ||
| 160 | |||
| 161 | ✗ | if(combo_aliases[j].csets != NULL) | |
| 162 | { | ||
| 163 | ✗ | delete[] combo_aliases[j].csets; | |
| 164 | ✗ | combo_aliases[j].csets=NULL; | |
| 165 | } | ||
| 166 | } | ||
| 167 | |||
| 168 | } | ||
| 169 | |||
| 170 | ✗ | char *byte_conversion(int32_t number, int32_t format) | |
| 171 | { | ||
| 172 | static char num_str[40]; | ||
| 173 | |||
| 174 | ✗ | if(format==-1) //auto | |
| 175 | { | ||
| 176 | ✗ | format=1; //bytes | |
| 177 | |||
| 178 | ✗ | if(number>1024) | |
| 179 | { | ||
| 180 | ✗ | format=2; //kilobytes | |
| 181 | } | ||
| 182 | |||
| 183 | ✗ | if(number>1024*1024) | |
| 184 | { | ||
| 185 | ✗ | format=3; //megabytes | |
| 186 | } | ||
| 187 | |||
| 188 | ✗ | if(number>1024*1024*1024) | |
| 189 | { | ||
| 190 | ✗ | format=4; //gigabytes (dude, what are you doing?) | |
| 191 | } | ||
| 192 | } | ||
| 193 | |||
| 194 | ✗ | switch(format) | |
| 195 | { | ||
| 196 | case 1: //bytes | ||
| 197 | ✗ | sprintf(num_str,"%db",number); | |
| 198 | ✗ | break; | |
| 199 | |||
| 200 | case 2: //kilobytes | ||
| 201 | ✗ | sprintf(num_str,"%.2fk",float(number)/1024); | |
| 202 | ✗ | break; | |
| 203 | |||
| 204 | case 3: //megabytes | ||
| 205 | ✗ | sprintf(num_str,"%.2fM",float(number)/(1024*1024)); | |
| 206 | ✗ | break; | |
| 207 | |||
| 208 | case 4: //gigabytes | ||
| 209 | ✗ | sprintf(num_str,"%.2fG",float(number)/(1024*1024*1024)); | |
| 210 | ✗ | break; | |
| 211 | |||
| 212 | default: | ||
| 213 | ✗ | exit(1); | |
| 214 | break; | ||
| 215 | } | ||
| 216 | |||
| 217 | ✗ | return num_str; | |
| 218 | } | ||
| 219 | |||
| 220 | 196 | char *byte_conversion2(int32_t number1, int32_t number2, int32_t format1, int32_t format2) | |
| 221 | { | ||
| 222 | static char num_str1[40]; | ||
| 223 | static char num_str2[40]; | ||
| 224 | static char num_str[80]; | ||
| 225 | |||
| 226 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 196 times.
|
196 | if(format1==-1) //auto |
| 227 | { | ||
| 228 | 196 | format1=1; //bytes | |
| 229 | |||
| 230 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 196 times.
|
196 | if(number1>1024) |
| 231 | { | ||
| 232 | 196 | format1=2; //kilobytes | |
| 233 | 196 | } | |
| 234 | |||
| 235 |
2/2✓ Branch 0 taken 140 times.
✓ Branch 1 taken 56 times.
|
196 | if(number1>1024*1024) |
| 236 | { | ||
| 237 | 56 | format1=3; //megabytes | |
| 238 | 56 | } | |
| 239 | |||
| 240 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(number1>1024*1024*1024) |
| 241 | { | ||
| 242 | ✗ | format1=4; //gigabytes (dude, what are you doing?) | |
| 243 | } | ||
| 244 | 196 | } | |
| 245 | |||
| 246 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 196 times.
|
196 | if(format2==-1) //auto |
| 247 | { | ||
| 248 | 196 | format2=1; //bytes | |
| 249 | |||
| 250 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 196 times.
|
196 | if(number2>1024) |
| 251 | { | ||
| 252 | 196 | format2=2; //kilobytes | |
| 253 | 196 | } | |
| 254 | |||
| 255 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 182 times.
|
196 | if(number2>1024*1024) |
| 256 | { | ||
| 257 | 182 | format2=3; //megabytes | |
| 258 | 182 | } | |
| 259 | |||
| 260 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(number2>1024*1024*1024) |
| 261 | { | ||
| 262 | ✗ | format2=4; //gigabytes (dude, what are you doing?) | |
| 263 | } | ||
| 264 | 196 | } | |
| 265 | |||
| 266 |
2/5✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 140 times.
✓ Branch 3 taken 56 times.
✗ Branch 4 not taken.
|
196 | switch(format1) |
| 267 | { | ||
| 268 | case 1: //bytes | ||
| 269 | ✗ | sprintf(num_str1,"%db",number1); | |
| 270 | ✗ | break; | |
| 271 | |||
| 272 | case 2: //kilobytes | ||
| 273 | 140 | sprintf(num_str1,"%.2fk",float(number1)/1024); | |
| 274 | 140 | break; | |
| 275 | |||
| 276 | case 3: //megabytes | ||
| 277 | 56 | sprintf(num_str1,"%.2fM",float(number1)/(1024*1024)); | |
| 278 | 56 | break; | |
| 279 | |||
| 280 | case 4: //gigabytes | ||
| 281 | ✗ | sprintf(num_str1,"%.2fG",float(number1)/(1024*1024*1024)); | |
| 282 | ✗ | break; | |
| 283 | |||
| 284 | default: | ||
| 285 | ✗ | exit(1); | |
| 286 | break; | ||
| 287 | } | ||
| 288 | |||
| 289 |
2/5✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 182 times.
✗ Branch 4 not taken.
|
196 | switch(format2) |
| 290 | { | ||
| 291 | case 1: //bytes | ||
| 292 | ✗ | sprintf(num_str2,"%db",number2); | |
| 293 | ✗ | break; | |
| 294 | |||
| 295 | case 2: //kilobytes | ||
| 296 | 14 | sprintf(num_str2,"%.2fk",float(number2)/1024); | |
| 297 | 14 | break; | |
| 298 | |||
| 299 | case 3: //megabytes | ||
| 300 | 182 | sprintf(num_str2,"%.2fM",float(number2)/(1024*1024)); | |
| 301 | 182 | break; | |
| 302 | |||
| 303 | case 4: //gigabytes | ||
| 304 | ✗ | sprintf(num_str2,"%.2fG",float(number2)/(1024*1024*1024)); | |
| 305 | ✗ | break; | |
| 306 | |||
| 307 | default: | ||
| 308 | ✗ | exit(1); | |
| 309 | break; | ||
| 310 | } | ||
| 311 | |||
| 312 | 196 | sprintf(num_str, "%s/%s", num_str1, num_str2); | |
| 313 | 196 | return num_str; | |
| 314 | } | ||
| 315 | |||
| 316 | ✗ | char *ordinal(int32_t num) | |
| 317 | { | ||
| 318 | static const char *ending[4] = {"st","nd","rd","th"}; | ||
| 319 | static char ord_str[8]; | ||
| 320 | |||
| 321 | char *end; | ||
| 322 | ✗ | int32_t t=(num%100)/10; | |
| 323 | ✗ | int32_t n=num%10; | |
| 324 | |||
| 325 | ✗ | if(n>=1 && n<4 && t!=1) | |
| 326 | ✗ | end = (char *)ending[n-1]; | |
| 327 | else | ||
| 328 | ✗ | end = (char *)ending[3]; | |
| 329 | |||
| 330 | ✗ | sprintf(ord_str,"%d%s",num%10000,end); | |
| 331 | ✗ | return ord_str; | |
| 332 | } | ||
| 333 | |||
| 334 | 14 | int32_t get_version_and_build(PACKFILE *f, word *version, word *build) | |
| 335 | { | ||
| 336 | int32_t ret; | ||
| 337 | 14 | *version=0; | |
| 338 | 14 | *build=0; | |
| 339 | 14 | byte temp_map_count=map_count; | |
| 340 | byte temp_midi_flags[MIDIFLAGS_SIZE]; | ||
| 341 | 14 | memcpy(temp_midi_flags, midi_flags, MIDIFLAGS_SIZE); | |
| 342 | |||
| 343 | zquestheader tempheader; | ||
| 344 | |||
| 345 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if(!f) |
| 346 | { | ||
| 347 | ✗ | return qe_invalid; | |
| 348 | } | ||
| 349 | |||
| 350 | 14 | ret=readheader(f, &tempheader, true); | |
| 351 | |||
| 352 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if(ret) |
| 353 | { | ||
| 354 | ✗ | return ret; | |
| 355 | } | ||
| 356 | |||
| 357 | 14 | map_count=temp_map_count; | |
| 358 | 14 | memcpy(midi_flags, temp_midi_flags, MIDIFLAGS_SIZE); | |
| 359 | 14 | *version=tempheader.zelda_version; | |
| 360 | 14 | *build=tempheader.build; | |
| 361 | 14 | return 0; | |
| 362 | 14 | } | |
| 363 | |||
| 364 | |||
| 365 | 14 | bool find_section(PACKFILE *f, int32_t section_id_requested) | |
| 366 | { | ||
| 367 | |||
| 368 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if(!f) |
| 369 | { | ||
| 370 | ✗ | return false; | |
| 371 | } | ||
| 372 | |||
| 373 | int32_t section_id_read; | ||
| 374 | 14 | bool catchup=false; | |
| 375 | word dummy; | ||
| 376 | byte tempbyte; | ||
| 377 | char tempbuf[65536]; | ||
| 378 | |||
| 379 | |||
| 380 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | switch(section_id_requested) |
| 381 | { | ||
| 382 | case ID_RULES: | ||
| 383 | case ID_STRINGS: | ||
| 384 | case ID_MISC: | ||
| 385 | case ID_TILES: | ||
| 386 | case ID_COMBOS: | ||
| 387 | case ID_CSETS: | ||
| 388 | case ID_MAPS: | ||
| 389 | case ID_DMAPS: | ||
| 390 | case ID_DOORS: | ||
| 391 | case ID_ITEMS: | ||
| 392 | case ID_WEAPONS: | ||
| 393 | case ID_COLORS: | ||
| 394 | case ID_ICONS: | ||
| 395 | case ID_INITDATA: | ||
| 396 | case ID_GUYS: | ||
| 397 | case ID_MIDIS: | ||
| 398 | case ID_CHEATS: | ||
| 399 | 14 | break; | |
| 400 | |||
| 401 | default: | ||
| 402 | ✗ | al_trace("Bad section requested!\n"); | |
| 403 | ✗ | return false; | |
| 404 | break; | ||
| 405 | } | ||
| 406 | |||
| 407 | dword section_size; | ||
| 408 | |||
| 409 | //section id | ||
| 410 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if(!p_mgetl(§ion_id_read,f,true)) |
| 411 | { | ||
| 412 | ✗ | return false; | |
| 413 | } | ||
| 414 | |||
| 415 |
1/2✓ Branch 0 taken 2856 times.
✗ Branch 1 not taken.
|
2856 | while(!pack_feof(f)) |
| 416 | { | ||
| 417 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 2842 times.
|
2856 | switch(section_id_read) |
| 418 | { | ||
| 419 | case ID_RULES: | ||
| 420 | case ID_STRINGS: | ||
| 421 | case ID_MISC: | ||
| 422 | case ID_TILES: | ||
| 423 | case ID_COMBOS: | ||
| 424 | case ID_CSETS: | ||
| 425 | case ID_MAPS: | ||
| 426 | case ID_DMAPS: | ||
| 427 | case ID_DOORS: | ||
| 428 | case ID_ITEMS: | ||
| 429 | case ID_WEAPONS: | ||
| 430 | case ID_COLORS: | ||
| 431 | case ID_ICONS: | ||
| 432 | case ID_INITDATA: | ||
| 433 | case ID_GUYS: | ||
| 434 | case ID_MIDIS: | ||
| 435 | case ID_CHEATS: | ||
| 436 | 14 | catchup=false; | |
| 437 | 14 | break; | |
| 438 | |||
| 439 | default: | ||
| 440 | 2842 | break; | |
| 441 | } | ||
| 442 | |||
| 443 | |||
| 444 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2856 times.
|
2856 | while(catchup) |
| 445 | { | ||
| 446 | //section id | ||
| 447 | ✗ | section_id_read=(section_id_read<<8); | |
| 448 | |||
| 449 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 450 | { | ||
| 451 | ✗ | return false; | |
| 452 | } | ||
| 453 | |||
| 454 | ✗ | section_id_read+=tempbyte; | |
| 455 | } | ||
| 456 | |||
| 457 |
1/2✓ Branch 0 taken 2856 times.
✗ Branch 1 not taken.
|
2856 | if(section_id_read==section_id_requested) |
| 458 | { | ||
| 459 | ✗ | return true; | |
| 460 | } | ||
| 461 | else | ||
| 462 | { | ||
| 463 | //section version info | ||
| 464 |
1/2✓ Branch 0 taken 2856 times.
✗ Branch 1 not taken.
|
2856 | if(!p_igetw(&dummy,f,true)) |
| 465 | { | ||
| 466 | ✗ | return false; | |
| 467 | } | ||
| 468 | |||
| 469 |
1/2✓ Branch 0 taken 2856 times.
✗ Branch 1 not taken.
|
2856 | if(!p_igetw(&dummy,f,true)) |
| 470 | { | ||
| 471 | ✗ | return false; | |
| 472 | } | ||
| 473 | |||
| 474 | //section size | ||
| 475 |
1/2✓ Branch 0 taken 2856 times.
✗ Branch 1 not taken.
|
2856 | if(!p_igetl(§ion_size,f,true)) |
| 476 | { | ||
| 477 | ✗ | return false; | |
| 478 | } | ||
| 479 | |||
| 480 | //pack_fseek(f, section_size); | ||
| 481 |
2/2✓ Branch 0 taken 917490 times.
✓ Branch 1 taken 2856 times.
|
920346 | while(section_size>65535) |
| 482 | { | ||
| 483 | 917490 | pfread(tempbuf,65535,f,true); | |
| 484 | 917490 | tempbuf[65535]=0; | |
| 485 | 917490 | section_size-=65535; | |
| 486 | } | ||
| 487 | |||
| 488 |
2/2✓ Branch 0 taken 2786 times.
✓ Branch 1 taken 70 times.
|
2856 | if(section_size>0) |
| 489 | { | ||
| 490 | 70 | pfread(tempbuf,section_size,f,true); | |
| 491 | 70 | tempbuf[section_size]=0; | |
| 492 | 70 | } | |
| 493 | } | ||
| 494 | |||
| 495 | //section id | ||
| 496 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 2842 times.
|
2856 | if(!p_mgetl(§ion_id_read,f,true)) |
| 497 | { | ||
| 498 | 14 | return false; | |
| 499 | } | ||
| 500 | } | ||
| 501 | |||
| 502 | ✗ | return false; | |
| 503 | 14 | } | |
| 504 | |||
| 505 | |||
| 506 | |||
| 507 | |||
| 508 | |||
| 509 | 14 | bool valid_zqt(PACKFILE *f) | |
| 510 | { | ||
| 511 | |||
| 512 | //word tiles_used; | ||
| 513 | //word combos_used; | ||
| 514 | //open the file | ||
| 515 | //PACKFILE *f = pack_fopen(path, F_READ_PACKED); | ||
| 516 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if(!f) |
| 517 | ✗ | return false; | |
| 518 | |||
| 519 | //for now, everything else is valid | ||
| 520 | 14 | return true; | |
| 521 | |||
| 522 | /*int16_t version; | ||
| 523 | byte build; | ||
| 524 | |||
| 525 | //read the version and make sure it worked | ||
| 526 | if(!p_igetw(&version,f,true)) | ||
| 527 | { | ||
| 528 | goto error; | ||
| 529 | } | ||
| 530 | |||
| 531 | //read the build and make sure it worked | ||
| 532 | if(!p_getc(&build,f,true)) | ||
| 533 | goto error; | ||
| 534 | |||
| 535 | //read the tile info and make sure it worked | ||
| 536 | if(!p_igetw(&tiles_used,f,true)) | ||
| 537 | { | ||
| 538 | goto error; | ||
| 539 | } | ||
| 540 | |||
| 541 | for (int32_t i=0; i<tiles_used; i++) | ||
| 542 | { | ||
| 543 | if(!pfread(trashbuf,tilesize(tf4Bit),f,true)) | ||
| 544 | { | ||
| 545 | goto error; | ||
| 546 | } | ||
| 547 | } | ||
| 548 | |||
| 549 | //read the combo info and make sure it worked | ||
| 550 | if(!p_igetw(&combos_used,f,true)) | ||
| 551 | { | ||
| 552 | goto error; | ||
| 553 | } | ||
| 554 | for (int32_t i=0; i<combos_used; i++) | ||
| 555 | { | ||
| 556 | if(!pfread(trashbuf,sizeof(newcombo),f,true)) | ||
| 557 | { | ||
| 558 | goto error; | ||
| 559 | } | ||
| 560 | } | ||
| 561 | |||
| 562 | //read the palette info and make sure it worked | ||
| 563 | for (int32_t i=0; i<48; i++) | ||
| 564 | { | ||
| 565 | if(!pfread(trashbuf,newpdTOTAL,f,true)) | ||
| 566 | { | ||
| 567 | goto error; | ||
| 568 | } | ||
| 569 | } | ||
| 570 | if(!pfread(trashbuf,sizeof(palcycle)*256*3,f,true)) | ||
| 571 | { | ||
| 572 | goto error; | ||
| 573 | } | ||
| 574 | for (int32_t i=0; i<MAXLEVELS; i++) | ||
| 575 | { | ||
| 576 | if(!pfread(trashbuf,PALNAMESIZE,f,true)) | ||
| 577 | { | ||
| 578 | goto error; | ||
| 579 | } | ||
| 580 | } | ||
| 581 | |||
| 582 | //read the sprite info and make sure it worked | ||
| 583 | for (int32_t i=0; i<MAXITEMS; i++) | ||
| 584 | { | ||
| 585 | if(!pfread(trashbuf,sizeof(itemdata),f,true)) | ||
| 586 | { | ||
| 587 | goto error; | ||
| 588 | } | ||
| 589 | } | ||
| 590 | |||
| 591 | for (int32_t i=0; i<MAXWPNS; i++) | ||
| 592 | { | ||
| 593 | if(!pfread(trashbuf,sizeof(wpndata),f,true)) | ||
| 594 | { | ||
| 595 | goto error; | ||
| 596 | } | ||
| 597 | } | ||
| 598 | |||
| 599 | //read the triforce pieces info and make sure it worked | ||
| 600 | for (int32_t i=0; i<8; ++i) | ||
| 601 | { | ||
| 602 | if(!p_getc(&trashbuf,f,true)) | ||
| 603 | { | ||
| 604 | goto error; | ||
| 605 | } | ||
| 606 | } | ||
| 607 | |||
| 608 | |||
| 609 | |||
| 610 | //read the game icons info and make sure it worked | ||
| 611 | for (int32_t i=0; i<4; ++i) | ||
| 612 | { | ||
| 613 | if(!p_igetw(&trashbuf,f,true)) | ||
| 614 | { | ||
| 615 | goto error; | ||
| 616 | } | ||
| 617 | } | ||
| 618 | |||
| 619 | //read the misc colors info and map styles info and make sure it worked | ||
| 620 | if(!pfread(trashbuf,sizeof(zcolors),f,true)) | ||
| 621 | { | ||
| 622 | goto error; | ||
| 623 | } | ||
| 624 | |||
| 625 | //read the template screens and make sure it worked | ||
| 626 | byte num_maps; | ||
| 627 | if(!p_getc(&num_maps,f,true)) | ||
| 628 | { | ||
| 629 | goto error; | ||
| 630 | } | ||
| 631 | for (int32_t i=0; i<TEMPLATES; i++) | ||
| 632 | { | ||
| 633 | if(!pfread(trashbuf,sizeof(mapscr),f,true)) | ||
| 634 | { | ||
| 635 | goto error; | ||
| 636 | } | ||
| 637 | } | ||
| 638 | if (num_maps>1) //dungeon templates | ||
| 639 | { | ||
| 640 | for (int32_t i=0; i<TEMPLATES; i++) | ||
| 641 | { | ||
| 642 | if(!pfread(trashbuf,sizeof(mapscr),f,true)) | ||
| 643 | { | ||
| 644 | goto error; | ||
| 645 | } | ||
| 646 | } | ||
| 647 | } | ||
| 648 | |||
| 649 | //yay! it worked! close the file and say everything was ok. | ||
| 650 | pack_fclose(f); | ||
| 651 | return true; | ||
| 652 | |||
| 653 | error: | ||
| 654 | pack_fclose(f); | ||
| 655 | return false;*/ | ||
| 656 | 14 | } | |
| 657 | |||
| 658 | ✗ | bool valid_zqt(const char *filename) | |
| 659 | { | ||
| 660 | ✗ | PACKFILE *f=NULL; | |
| 661 | bool isvalid; | ||
| 662 | char deletefilename[1024]; | ||
| 663 | ✗ | deletefilename[0]=0; | |
| 664 | int32_t error; | ||
| 665 | ✗ | f=open_quest_file(&error, filename, deletefilename, true, true,false); | |
| 666 | |||
| 667 | ✗ | if(!f) | |
| 668 | { | ||
| 669 | // setPackfilePassword(NULL); | ||
| 670 | ✗ | return false; | |
| 671 | } | ||
| 672 | |||
| 673 | ✗ | isvalid=valid_zqt(f); | |
| 674 | |||
| 675 | ✗ | if(deletefilename[0]) | |
| 676 | { | ||
| 677 | ✗ | delete_file(deletefilename); | |
| 678 | } | ||
| 679 | |||
| 680 | // setPackfilePassword(NULL); | ||
| 681 | ✗ | return isvalid; | |
| 682 | } | ||
| 683 | |||
| 684 | 91 | PACKFILE *open_quest_file(int32_t *open_error, const char *filename, char *deletefilename, bool compressed,bool encrypted, bool show_progress) | |
| 685 | { | ||
| 686 | char tmpfilename[L_tmpnam]; | ||
| 687 | 91 | temp_name(tmpfilename); | |
| 688 | char percent_done[30]; | ||
| 689 | 91 | int32_t current_method=0; | |
| 690 | |||
| 691 | PACKFILE *f; | ||
| 692 | 91 | const char *passwd= encrypted ? datapwd : ""; | |
| 693 | |||
| 694 | // oldquest flag is set when an unencrypted qst file is suspected. | ||
| 695 | 91 | bool oldquest = false; | |
| 696 | int32_t ret; | ||
| 697 | |||
| 698 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(show_progress) |
| 699 | { | ||
| 700 | ✗ | box_start(1, "Loading Quest", lfont, font, true); | |
| 701 | } | ||
| 702 | |||
| 703 | 91 | box_out("Loading Quest: "); | |
| 704 | //if(strncasecmp(filename, "qst.dat", 7)!=0) | ||
| 705 | //int32_t qstdat_str_size = 0; | ||
| 706 | //for ( int32_t q = 0; q < 255; q++ ) //find the length of the string | ||
| 707 | //{ | ||
| 708 | // if ( moduledata.datafiles[qst_dat][q] != 0 ) qstdat_str_size++; | ||
| 709 | // else break; | ||
| 710 | //} | ||
| 711 | //if(strncasecmp(filename, moduledata.datafiles[qst_dat], 7)!=0) | ||
| 712 | 91 | al_trace("Trying to do strncasecmp() when loading a quest\n"); | |
| 713 | 91 | int32_t qstdat_filename_size = strlen(moduledata.datafiles[qst_dat]); | |
| 714 | 91 | al_trace("Filename size of qst.dat file %s is %d.\n", moduledata.datafiles[qst_dat], qstdat_filename_size); | |
| 715 | //if(strncasecmp(filename, moduledata.datafiles[qst_dat], qstdat_filename_size)!=0) | ||
| 716 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(strcmp(filename, moduledata.datafiles[qst_dat])!=0) |
| 717 | { | ||
| 718 | 91 | box_out(filename); | |
| 719 | 91 | } | |
| 720 | else | ||
| 721 | { | ||
| 722 | ✗ | box_out("new quest"); // Or whatever | |
| 723 | } | ||
| 724 | 91 | box_out("..."); | |
| 725 | 91 | box_eol(); | |
| 726 | 91 | box_eol(); | |
| 727 | |||
| 728 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(encrypted) |
| 729 | { | ||
| 730 | 91 | box_out("Decrypting..."); | |
| 731 | 91 | box_save_x(); | |
| 732 | 91 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_MAX-1, strstr(filename, ".dat#")!=NULL, passwd); | |
| 733 | |||
| 734 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(ret) |
| 735 | { | ||
| 736 | ✗ | switch(ret) | |
| 737 | { | ||
| 738 | case 1: | ||
| 739 | ✗ | box_out("error."); | |
| 740 | ✗ | box_eol(); | |
| 741 | ✗ | box_end(true); | |
| 742 | ✗ | *open_error=qe_notfound; | |
| 743 | ✗ | return NULL; | |
| 744 | |||
| 745 | case 2: | ||
| 746 | ✗ | box_out("error."); | |
| 747 | ✗ | box_eol(); | |
| 748 | ✗ | box_end(true); | |
| 749 | ✗ | *open_error=qe_internal; | |
| 750 | ✗ | return NULL; | |
| 751 | // be sure not to delete tmpfilename now... | ||
| 752 | } | ||
| 753 | |||
| 754 | ✗ | if(ret==5) //old encryption? | |
| 755 | { | ||
| 756 | ✗ | current_method++; | |
| 757 | ✗ | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 758 | ✗ | box_out(percent_done); | |
| 759 | ✗ | box_load_x(); | |
| 760 | ✗ | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_211B9, strstr(filename, ".dat#")!=NULL, passwd); | |
| 761 | } | ||
| 762 | |||
| 763 | ✗ | if(ret==5) //old encryption? | |
| 764 | { | ||
| 765 | ✗ | current_method++; | |
| 766 | ✗ | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 767 | ✗ | box_out(percent_done); | |
| 768 | ✗ | box_load_x(); | |
| 769 | ✗ | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_192B185, strstr(filename, ".dat#")!=NULL, passwd); | |
| 770 | } | ||
| 771 | |||
| 772 | ✗ | if(ret==5) //old encryption? | |
| 773 | { | ||
| 774 | ✗ | current_method++; | |
| 775 | ✗ | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 776 | ✗ | box_out(percent_done); | |
| 777 | ✗ | box_load_x(); | |
| 778 | ✗ | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_192B105, strstr(filename, ".dat#")!=NULL, passwd); | |
| 779 | } | ||
| 780 | |||
| 781 | ✗ | if(ret==5) //old encryption? | |
| 782 | { | ||
| 783 | ✗ | current_method++; | |
| 784 | ✗ | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 785 | ✗ | box_out(percent_done); | |
| 786 | ✗ | box_load_x(); | |
| 787 | ✗ | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_192B104, strstr(filename, ".dat#")!=NULL, passwd); | |
| 788 | } | ||
| 789 | |||
| 790 | ✗ | if(ret) | |
| 791 | { | ||
| 792 | ✗ | oldquest = true; | |
| 793 | ✗ | passwd=""; | |
| 794 | } | ||
| 795 | } | ||
| 796 | |||
| 797 | 91 | box_out("okay."); | |
| 798 | 91 | box_eol(); | |
| 799 | 91 | } | |
| 800 | else | ||
| 801 | { | ||
| 802 | ✗ | oldquest = true; | |
| 803 | } | ||
| 804 | |||
| 805 | 91 | box_out("Opening..."); | |
| 806 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 91 times.
|
91 | f = pack_fopen_password(oldquest ? filename : tmpfilename, compressed ? F_READ_PACKED : F_READ, passwd); |
| 807 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!f) |
| 808 | { | ||
| 809 | ✗ | if((compressed==1)&&(errno==EDOM)) | |
| 810 | { | ||
| 811 | ✗ | f = pack_fopen_password(oldquest ? filename : tmpfilename, F_READ, passwd); | |
| 812 | } | ||
| 813 | |||
| 814 | ✗ | if(!f) | |
| 815 | { | ||
| 816 | ✗ | if(!oldquest) | |
| 817 | { | ||
| 818 | ✗ | delete_file(tmpfilename); | |
| 819 | } | ||
| 820 | ✗ | box_out("error."); | |
| 821 | ✗ | box_eol(); | |
| 822 | ✗ | box_end(true); | |
| 823 | ✗ | *open_error=qe_invalid; | |
| 824 | ✗ | return NULL; | |
| 825 | } | ||
| 826 | } | ||
| 827 | |||
| 828 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 91 times.
|
91 | if(!oldquest) |
| 829 | { | ||
| 830 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 91 times.
|
91 | if(deletefilename) |
| 831 | 91 | sprintf(deletefilename, "%s", tmpfilename); | |
| 832 | 91 | } | |
| 833 | |||
| 834 | 91 | box_out("okay."); | |
| 835 | 91 | box_eol(); | |
| 836 | |||
| 837 | 91 | return f; | |
| 838 | 91 | } | |
| 839 | |||
| 840 | 14 | PACKFILE *open_quest_template(zquestheader *Header, char *deletefilename, bool validate) | |
| 841 | { | ||
| 842 | char *filename; | ||
| 843 | 14 | PACKFILE *f=NULL; | |
| 844 | 14 | int32_t open_error=0; | |
| 845 | 14 | deletefilename[0]=0; | |
| 846 | |||
| 847 | 14 | strcpy(qstdat_string,moduledata.datafiles[qst_dat]); | |
| 848 | 14 | strcat(qstdat_string,"#NESQST_NEW_QST"); | |
| 849 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if(Header->templatepath[0]==0) |
| 850 | { | ||
| 851 | 14 | filename=(char *)malloc(2048); | |
| 852 | //strcpy(filename, "qst.dat#NESQST_NEW_QST"); | ||
| 853 | 14 | strcpy(filename, qstdat_string); | |
| 854 | 14 | } | |
| 855 | else | ||
| 856 | { | ||
| 857 | ✗ | filename=Header->templatepath; | |
| 858 | } | ||
| 859 | |||
| 860 | 14 | f=open_quest_file(&open_error, filename, deletefilename, true, true,false); | |
| 861 | |||
| 862 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if(Header->templatepath[0]==0) |
| 863 | { | ||
| 864 | 14 | free(filename); | |
| 865 | 14 | } | |
| 866 | |||
| 867 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if(!f) |
| 868 | { | ||
| 869 | ✗ | return NULL; | |
| 870 | } | ||
| 871 | |||
| 872 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if(validate) |
| 873 | { | ||
| 874 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if(!valid_zqt(f)) |
| 875 | { | ||
| 876 | ✗ | jwin_alert("Error","Invalid Quest Template",NULL,NULL,"O&K",NULL,'k',0,lfont); | |
| 877 | ✗ | pack_fclose(f); | |
| 878 | |||
| 879 | //setPackfilePassword(NULL); | ||
| 880 | ✗ | if(deletefilename[0]) | |
| 881 | { | ||
| 882 | ✗ | delete_file(deletefilename); | |
| 883 | } | ||
| 884 | |||
| 885 | ✗ | return NULL; | |
| 886 | } | ||
| 887 | 14 | } | |
| 888 | |||
| 889 | 14 | return f; | |
| 890 | 14 | } | |
| 891 | |||
| 892 | 14 | bool init_section(zquestheader *Header, int32_t section_id, miscQdata *Misc, zctune *tunes, bool validate) | |
| 893 | { | ||
| 894 | 14 | combosread=false; | |
| 895 | 14 | mapsread=false; | |
| 896 | 14 | fixffcs=false; | |
| 897 | |||
| 898 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | switch(section_id) |
| 899 | { | ||
| 900 | case ID_RULES: | ||
| 901 | case ID_STRINGS: | ||
| 902 | case ID_MISC: | ||
| 903 | case ID_TILES: | ||
| 904 | case ID_COMBOS: | ||
| 905 | case ID_CSETS: | ||
| 906 | case ID_MAPS: | ||
| 907 | case ID_DMAPS: | ||
| 908 | case ID_DOORS: | ||
| 909 | case ID_ITEMS: | ||
| 910 | case ID_WEAPONS: | ||
| 911 | case ID_COLORS: | ||
| 912 | case ID_ICONS: | ||
| 913 | case ID_INITDATA: | ||
| 914 | case ID_GUYS: | ||
| 915 | case ID_MIDIS: | ||
| 916 | case ID_CHEATS: | ||
| 917 | case ID_ITEMDROPSETS: | ||
| 918 | case ID_FAVORITES: | ||
| 919 | 14 | break; | |
| 920 | |||
| 921 | default: | ||
| 922 | ✗ | return false; | |
| 923 | break; | ||
| 924 | } | ||
| 925 | |||
| 926 | int32_t ret; | ||
| 927 | word version, build; | ||
| 928 | 14 | PACKFILE *f=NULL; | |
| 929 | |||
| 930 | char deletefilename[1024]; | ||
| 931 | 14 | deletefilename[0]=0; | |
| 932 | |||
| 933 | //why is this here? | ||
| 934 | /* | ||
| 935 | if(colordata==NULL) | ||
| 936 | return false; | ||
| 937 | */ | ||
| 938 | |||
| 939 | //setPackfilePassword(datapwd); | ||
| 940 | 14 | f=open_quest_template(Header, deletefilename, validate); | |
| 941 | |||
| 942 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if(!f) //no file, nothing to delete |
| 943 | { | ||
| 944 | // setPackfilePassword(NULL); | ||
| 945 | ✗ | return false; | |
| 946 | } | ||
| 947 | |||
| 948 | 14 | ret=get_version_and_build(f, &version, &build); | |
| 949 | |||
| 950 |
2/4✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 14 times.
|
14 | if(ret||(version==0)) |
| 951 | { | ||
| 952 | ✗ | pack_fclose(f); | |
| 953 | |||
| 954 | ✗ | if(deletefilename[0]) | |
| 955 | { | ||
| 956 | ✗ | delete_file(deletefilename); | |
| 957 | } | ||
| 958 | |||
| 959 | // setPackfilePassword(NULL); | ||
| 960 | ✗ | return false; | |
| 961 | } | ||
| 962 | |||
| 963 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if(!find_section(f, section_id)) |
| 964 | { | ||
| 965 | 14 | al_trace("Can't find section!\n"); | |
| 966 | 14 | pack_fclose(f); | |
| 967 | |||
| 968 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if(deletefilename[0]) |
| 969 | { | ||
| 970 | 14 | delete_file(deletefilename); | |
| 971 | 14 | } | |
| 972 | |||
| 973 | //setPackfilePassword(NULL); | ||
| 974 | 14 | return false; | |
| 975 | } | ||
| 976 | |||
| 977 | ✗ | switch(section_id) | |
| 978 | { | ||
| 979 | case ID_RULES: | ||
| 980 | //rules | ||
| 981 | ✗ | ret=readrules(f, Header, true); | |
| 982 | ✗ | break; | |
| 983 | |||
| 984 | case ID_STRINGS: | ||
| 985 | //strings | ||
| 986 | ✗ | ret=readstrings(f, Header, true); | |
| 987 | ✗ | break; | |
| 988 | |||
| 989 | case ID_MISC: | ||
| 990 | //misc data | ||
| 991 | ✗ | ret=readmisc(f, Header, Misc, true); | |
| 992 | ✗ | break; | |
| 993 | |||
| 994 | case ID_TILES: | ||
| 995 | //tiles | ||
| 996 | ✗ | ret=readtiles(f, newtilebuf, Header, version, build, 0, NEWMAXTILES, true, true); | |
| 997 | ✗ | break; | |
| 998 | |||
| 999 | case ID_COMBOS: | ||
| 1000 | //combos | ||
| 1001 | ✗ | clear_combos(); | |
| 1002 | ✗ | ret=readcombos(f, Header, version, build, 0, MAXCOMBOS, true); | |
| 1003 | ✗ | combosread=true; | |
| 1004 | ✗ | break; | |
| 1005 | |||
| 1006 | case ID_COMBOALIASES: | ||
| 1007 | //combos | ||
| 1008 | ✗ | ret=readcomboaliases(f, Header, version, build, true); | |
| 1009 | ✗ | break; | |
| 1010 | |||
| 1011 | case ID_CSETS: | ||
| 1012 | //color data | ||
| 1013 | ✗ | ret=readcolordata(f, Misc, version, build, 0, newerpdTOTAL, true); | |
| 1014 | ✗ | break; | |
| 1015 | |||
| 1016 | case ID_MAPS: | ||
| 1017 | //maps | ||
| 1018 | ✗ | ret=readmaps(f, Header, true); | |
| 1019 | ✗ | mapsread=true; | |
| 1020 | ✗ | break; | |
| 1021 | |||
| 1022 | case ID_DMAPS: | ||
| 1023 | //dmaps | ||
| 1024 | ✗ | ret=readdmaps(f, Header, version, build, 0, MAXDMAPS, true); | |
| 1025 | ✗ | break; | |
| 1026 | |||
| 1027 | case ID_DOORS: | ||
| 1028 | //door combo sets | ||
| 1029 | ✗ | ret=readdoorcombosets(f, Header, true); | |
| 1030 | ✗ | break; | |
| 1031 | |||
| 1032 | case ID_ITEMS: | ||
| 1033 | //items | ||
| 1034 | ✗ | ret=readitems(f, version, build, true); | |
| 1035 | ✗ | break; | |
| 1036 | |||
| 1037 | case ID_WEAPONS: | ||
| 1038 | //weapons | ||
| 1039 | ✗ | ret=readweapons(f, Header, true); | |
| 1040 | ✗ | break; | |
| 1041 | |||
| 1042 | case ID_COLORS: | ||
| 1043 | //misc. colors | ||
| 1044 | ✗ | ret=readmisccolors(f, Header, Misc, true); | |
| 1045 | ✗ | break; | |
| 1046 | |||
| 1047 | case ID_ICONS: | ||
| 1048 | //game icons | ||
| 1049 | ✗ | ret=readgameicons(f, Header, Misc, true); | |
| 1050 | ✗ | break; | |
| 1051 | |||
| 1052 | case ID_INITDATA: | ||
| 1053 | //initialization data | ||
| 1054 | ✗ | ret=readinitdata(f, Header, true); | |
| 1055 | ✗ | break; | |
| 1056 | |||
| 1057 | case ID_GUYS: | ||
| 1058 | //guys | ||
| 1059 | ✗ | ret=readguys(f, Header, true); | |
| 1060 | ✗ | break; | |
| 1061 | |||
| 1062 | case ID_MIDIS: | ||
| 1063 | //midis | ||
| 1064 | ✗ | ret=readtunes(f, Header, tunes, true); | |
| 1065 | ✗ | break; | |
| 1066 | |||
| 1067 | case ID_CHEATS: | ||
| 1068 | //cheat codes | ||
| 1069 | ✗ | ret=readcheatcodes(f, Header, true); | |
| 1070 | ✗ | break; | |
| 1071 | |||
| 1072 | case ID_ITEMDROPSETS: | ||
| 1073 | //item drop sets | ||
| 1074 | // Why is this one commented out? | ||
| 1075 | //ret=readitemdropsets(f, (int32_t)version, (word)build, true); | ||
| 1076 | ✗ | break; | |
| 1077 | |||
| 1078 | case ID_FAVORITES: | ||
| 1079 | // favorite combos and aliases | ||
| 1080 | ✗ | ret=readfavorites(f, version, build, true); | |
| 1081 | ✗ | break; | |
| 1082 | |||
| 1083 | default: | ||
| 1084 | ✗ | ret=-1; | |
| 1085 | ✗ | break; | |
| 1086 | } | ||
| 1087 | |||
| 1088 | ✗ | pack_fclose(f); | |
| 1089 | |||
| 1090 | ✗ | if(deletefilename[0]) | |
| 1091 | { | ||
| 1092 | ✗ | delete_file(deletefilename); | |
| 1093 | } | ||
| 1094 | |||
| 1095 | //setPackfilePassword(NULL); | ||
| 1096 | ✗ | if(!ret) | |
| 1097 | { | ||
| 1098 | ✗ | return true; | |
| 1099 | } | ||
| 1100 | |||
| 1101 | ✗ | return false; | |
| 1102 | 14 | } | |
| 1103 | |||
| 1104 | ✗ | bool init_tiles(bool validate, zquestheader *Header) | |
| 1105 | { | ||
| 1106 | ✗ | return init_section(Header, ID_TILES, NULL, NULL, validate); | |
| 1107 | } | ||
| 1108 | |||
| 1109 | ✗ | bool init_combos(bool validate, zquestheader *Header) | |
| 1110 | { | ||
| 1111 | ✗ | return init_section(Header, ID_COMBOS, NULL, NULL, validate); | |
| 1112 | } | ||
| 1113 | |||
| 1114 | ✗ | bool init_colordata(bool validate, zquestheader *Header, miscQdata *Misc) | |
| 1115 | { | ||
| 1116 | ✗ | return init_section(Header, ID_CSETS, Misc, NULL, validate); | |
| 1117 | } | ||
| 1118 | |||
| 1119 | 77 | void init_spritelists() | |
| 1120 | { | ||
| 1121 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
|
77 | if(FFCore.quest_format[vZelda] < 0x255) |
| 1122 | { | ||
| 1123 | 69 | guys.setMax(255); | |
| 1124 | 69 | items.setMax(255); | |
| 1125 | 69 | Ewpns.setMax(255); | |
| 1126 | 69 | Lwpns.setMax(255); | |
| 1127 | 69 | Sitems.setMax(255); | |
| 1128 | 69 | chainlinks.setMax(255); | |
| 1129 | 69 | decorations.setMax(255); | |
| 1130 | 69 | particles.setMax(255); | |
| 1131 | 69 | } | |
| 1132 | else | ||
| 1133 | { | ||
| 1134 | 8 | guys.setMax(255); | |
| 1135 | 8 | items.setMax(255); | |
| 1136 | 8 | Ewpns.setMax(255); | |
| 1137 | 8 | Lwpns.setMax(255); | |
| 1138 | 8 | Sitems.setMax(255); | |
| 1139 | 8 | chainlinks.setMax(255); | |
| 1140 | 8 | decorations.setMax(255); | |
| 1141 | 8 | particles.setMax(255*((255*4)+1)); //255 per sprite that can use particles; guys, items, ewpns, lwpns, +HERO | |
| 1142 | } | ||
| 1143 | 77 | } | |
| 1144 | |||
| 1145 | 14 | bool reset_items(bool validate, zquestheader *Header) | |
| 1146 | { | ||
| 1147 | 14 | bool ret = init_section(Header, ID_ITEMS, NULL, NULL, validate); | |
| 1148 | |||
| 1149 | //Ignore this, but don't remove it | ||
| 1150 | /* | ||
| 1151 | if (ret) | ||
| 1152 | for(int32_t i=0; i<MAXITEMS; i++) | ||
| 1153 | { | ||
| 1154 | reset_itembuf(&itemsbuf[i], i); | ||
| 1155 | } | ||
| 1156 | */ | ||
| 1157 |
2/2✓ Branch 0 taken 3584 times.
✓ Branch 1 taken 14 times.
|
3598 | for(int32_t i=0; i<MAXITEMS; i++) reset_itemname(i); |
| 1158 | |||
| 1159 | 14 | return ret; | |
| 1160 | } | ||
| 1161 | |||
| 1162 | ✗ | bool reset_guys() | |
| 1163 | { | ||
| 1164 | // The .dat file's guys definitions are always synchronised with defdata.cpp's - even the tile settings. | ||
| 1165 | ✗ | init_guys(V_GUYS); | |
| 1166 | ✗ | return true; | |
| 1167 | } | ||
| 1168 | |||
| 1169 | ✗ | bool reset_wpns(bool validate, zquestheader *Header) | |
| 1170 | { | ||
| 1171 | ✗ | bool ret = init_section(Header, ID_WEAPONS, NULL, NULL, validate); | |
| 1172 | |||
| 1173 | ✗ | for(int32_t i=0; i<WPNCNT; i++) | |
| 1174 | ✗ | reset_weaponname(i); | |
| 1175 | |||
| 1176 | ✗ | return ret; | |
| 1177 | } | ||
| 1178 | |||
| 1179 | ✗ | bool reset_mapstyles(bool validate, miscQdata *Misc) | |
| 1180 | { | ||
| 1181 | ✗ | Misc->colors.blueframe_tile = 20044; | |
| 1182 | ✗ | Misc->colors.blueframe_cset = 0; | |
| 1183 | ✗ | Misc->colors.triforce_tile = 23461; | |
| 1184 | ✗ | Misc->colors.triforce_cset = 1; | |
| 1185 | ✗ | Misc->colors.triframe_tile = 18752; | |
| 1186 | ✗ | Misc->colors.triframe_cset = 1; | |
| 1187 | ✗ | Misc->colors.overworld_map_tile = 16990; | |
| 1188 | ✗ | Misc->colors.overworld_map_cset = 2; | |
| 1189 | ✗ | Misc->colors.HCpieces_tile = 21160; | |
| 1190 | ✗ | Misc->colors.HCpieces_cset = 8; | |
| 1191 | ✗ | Misc->colors.dungeon_map_tile = 19651; | |
| 1192 | ✗ | Misc->colors.dungeon_map_cset = 8; | |
| 1193 | ✗ | return true; | |
| 1194 | } | ||
| 1195 | |||
| 1196 | ✗ | bool reset_doorcombosets(bool validate, zquestheader *Header) | |
| 1197 | { | ||
| 1198 | ✗ | return init_section(Header, ID_DOORS, NULL, NULL, validate); | |
| 1199 | } | ||
| 1200 | |||
| 1201 | 14 | int32_t get_qst_buffers() | |
| 1202 | { | ||
| 1203 | 14 | memrequested+=(sizeof(mapscr)*MAPSCRS); | |
| 1204 | 14 | Z_message("Allocating map buffer (%s)... ", byte_conversion2(sizeof(mapscr)*MAPSCRS,memrequested,-1, -1)); | |
| 1205 | 14 | TheMaps.resize(MAPSCRS); | |
| 1206 | |||
| 1207 |
2/2✓ Branch 0 taken 1904 times.
✓ Branch 1 taken 14 times.
|
1918 | for(int32_t i(0); i<MAPSCRS; i++) |
| 1208 | 1904 | TheMaps[i].zero_memory(); | |
| 1209 | |||
| 1210 | //memset(TheMaps, 0, sizeof(mapscr)*MAPSCRS); //shouldn't need this anymore | ||
| 1211 | 14 | Z_message("OK\n"); // Allocating map buffer... | |
| 1212 | |||
| 1213 | 14 | memrequested+=(sizeof(zcmap)*MAXMAPS2); | |
| 1214 | 14 | Z_message("Allocating combo buffer (%s)... ", byte_conversion2(sizeof(zcmap)*MAXMAPS2,memrequested,-1,-1)); | |
| 1215 | |||
| 1216 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if((ZCMaps=(zcmap*)malloc(sizeof(zcmap)*MAXMAPS2))==NULL) |
| 1217 | ✗ | return 0; | |
| 1218 | |||
| 1219 | 14 | Z_message("OK\n"); | |
| 1220 | |||
| 1221 | // Allocating space for all 65535 strings uses up 10.62MB... | ||
| 1222 | // The vast majority of finished quests (and I presume this will be consistent for all time) use < 1000 strings in total. | ||
| 1223 | // (Shoelace's "Hero of Dreams" uses 1415.) | ||
| 1224 | // So let's be a bit generous and allow 4096 initially. | ||
| 1225 | // In the rare event that a quest overshoots this mark, we'll reallocate to the full 65535 later. | ||
| 1226 | // I tested it and it worked without flaw on 6/6/11. - L. | ||
| 1227 | // 2022: bumped from 4096 to 8192 to avoid a bug where the Strings menu shows (None) strings when the list passes | ||
| 1228 | // this threshold. Possibly some bug related to `msglistcache` to being reset? | ||
| 1229 | // See https://discord.com/channels/876899628556091432/992984989073416242 | ||
| 1230 | 14 | msg_strings_size = 8192; | |
| 1231 | 14 | memrequested+=(sizeof(MsgStr)*msg_strings_size); | |
| 1232 | 14 | Z_message("Allocating string buffer (%s)... ", byte_conversion2(sizeof(MsgStr)*msg_strings_size,memrequested,-1,-1)); | |
| 1233 | |||
| 1234 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | MsgStrings = new MsgStr[msg_strings_size]; |
| 1235 | |||
| 1236 | //memset(MsgStrings, 0, sizeof(MsgStr)*msg_strings_size); | ||
| 1237 |
2/2✓ Branch 0 taken 114688 times.
✓ Branch 1 taken 14 times.
|
114702 | for(auto q = 0; q < msg_strings_size; ++q) |
| 1238 | { | ||
| 1239 | 114688 | MsgStrings[q].clear(); | |
| 1240 | 114688 | } | |
| 1241 | 14 | Z_message("OK\n"); // Allocating string buffer... | |
| 1242 | |||
| 1243 | 14 | memrequested+=(sizeof(DoorComboSet)*MAXDOORCOMBOSETS); | |
| 1244 | 14 | Z_message("Allocating door combo buffer (%s)... ", byte_conversion2(sizeof(DoorComboSet)*MAXDOORCOMBOSETS,memrequested,-1,-1)); | |
| 1245 | |||
| 1246 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if((DoorComboSets=(DoorComboSet*)malloc(sizeof(DoorComboSet)*MAXDOORCOMBOSETS))==NULL) |
| 1247 | ✗ | return 0; | |
| 1248 | |||
| 1249 | 14 | Z_message("OK\n"); // Allocating door combo buffer... | |
| 1250 | |||
| 1251 | 14 | memrequested+=(sizeof(dmap)*MAXDMAPS); | |
| 1252 | 14 | Z_message("Allocating dmap buffer (%s)... ", byte_conversion2(sizeof(dmap)*MAXDMAPS,memrequested,-1,-1)); | |
| 1253 | |||
| 1254 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if((DMaps=(dmap*)malloc(sizeof(dmap)*MAXDMAPS))==NULL) |
| 1255 | ✗ | return 0; | |
| 1256 | |||
| 1257 | 14 | memset(DMaps, 0, sizeof(dmap)*MAXDMAPS); | |
| 1258 | 14 | Z_message("OK\n"); // Allocating dmap buffer... | |
| 1259 | |||
| 1260 | 14 | memrequested+=(sizeof(newcombo)*MAXCOMBOS); | |
| 1261 | 14 | Z_message("Allocating combo buffer (%s)... ", byte_conversion2(sizeof(newcombo)*MAXCOMBOS,memrequested,-1,-1)); | |
| 1262 | |||
| 1263 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if((combobuf=(newcombo*)malloc(sizeof(newcombo)*MAXCOMBOS))==NULL) |
| 1264 | ✗ | return 0; | |
| 1265 | |||
| 1266 | 14 | memset(combobuf, 0, sizeof(newcombo)*MAXCOMBOS); | |
| 1267 | 14 | Z_message("OK\n"); // Allocating combo buffer... | |
| 1268 | |||
| 1269 | 14 | memrequested+=(psTOTAL255); | |
| 1270 | 14 | Z_message("Allocating color data buffer (%s)... ", byte_conversion2(psTOTAL255,memrequested,-1,-1)); | |
| 1271 | |||
| 1272 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if((colordata=(byte*)malloc(psTOTAL255))==NULL) |
| 1273 | ✗ | return 0; | |
| 1274 | |||
| 1275 | 14 | Z_message("OK\n"); // Allocating color data buffer... | |
| 1276 | |||
| 1277 | 14 | memrequested+=(NEWMAXTILES*(sizeof(tiledata)+tilesize(tf4Bit))); | |
| 1278 | 14 | Z_message("Allocating tile buffer (%s)... ", byte_conversion2(NEWMAXTILES*(sizeof(tiledata)+tilesize(tf4Bit)),memrequested,-1,-1)); | |
| 1279 | |||
| 1280 | 14 | free_newtilebuf(); | |
| 1281 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if((newtilebuf=(tiledata*)malloc(NEWMAXTILES*sizeof(tiledata)))==NULL) |
| 1282 | ✗ | return 0; | |
| 1283 | |||
| 1284 | 14 | memset(newtilebuf, 0, NEWMAXTILES*sizeof(tiledata)); | |
| 1285 | //Z_message("Performed memset on tiles\n"); | ||
| 1286 | 14 | clear_tiles(newtilebuf); | |
| 1287 | //Z_message("Performed clear_tiles()\n"); | ||
| 1288 | 14 | Z_message("OK\n"); // Allocating tile buffer... | |
| 1289 | |||
| 1290 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if(is_zquest()) |
| 1291 | { | ||
| 1292 | ✗ | memrequested+=(NEWMAXTILES*(sizeof(tiledata)+tilesize(tf4Bit))); | |
| 1293 | ✗ | Z_message("Allocating tile grab buffer (%s)... ", byte_conversion2(NEWMAXTILES*sizeof(tiledata),memrequested,-1,-1)); | |
| 1294 | |||
| 1295 | ✗ | if((grabtilebuf=(tiledata*)malloc(NEWMAXTILES*sizeof(tiledata)))==NULL) | |
| 1296 | ✗ | return 0; | |
| 1297 | |||
| 1298 | ✗ | memset(grabtilebuf, 0, NEWMAXTILES*sizeof(tiledata)); | |
| 1299 | ✗ | clear_tiles(grabtilebuf); | |
| 1300 | ✗ | Z_message("OK\n"); // Allocating tile grab buffer... | |
| 1301 | } | ||
| 1302 | |||
| 1303 | 14 | memrequested+=(100000); | |
| 1304 | 14 | Z_message("Allocating trash buffer (%s)... ", byte_conversion2(100000,memrequested,-1,-1)); | |
| 1305 | |||
| 1306 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if((trashbuf=(byte*)malloc(100000))==NULL) |
| 1307 | ✗ | return 0; | |
| 1308 | |||
| 1309 | 14 | Z_message("OK\n"); // Allocating trash buffer... | |
| 1310 | |||
| 1311 | // Big, ugly band-aid here. Perhaps the most common cause of random crashes | ||
| 1312 | // has been inadvertently accessing itemsbuf[-1]. All such crashes should be | ||
| 1313 | // fixed by ensuring there's actually itemdata there. | ||
| 1314 | // If you change this, be sure to update del_qst_buffers, too. | ||
| 1315 | |||
| 1316 | 14 | memrequested+=(sizeof(itemdata)*(MAXITEMS+1)); | |
| 1317 | 14 | Z_message("Allocating item buffer (%s)... ", byte_conversion2(sizeof(itemdata)*(MAXITEMS+1),memrequested,-1,-1)); | |
| 1318 | |||
| 1319 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if((itemsbuf=(itemdata*)malloc(sizeof(itemdata)*(MAXITEMS+1)))==NULL) |
| 1320 | ✗ | return 0; | |
| 1321 | |||
| 1322 | 14 | memset(itemsbuf,0,sizeof(itemdata)*(MAXITEMS+1)); | |
| 1323 | 14 | itemsbuf++; | |
| 1324 | 14 | Z_message("OK\n"); // Allocating item buffer... | |
| 1325 | |||
| 1326 | 14 | memrequested+=(sizeof(wpndata)*MAXWPNS); | |
| 1327 | 14 | Z_message("Allocating weapon buffer (%s)... ", byte_conversion2(sizeof(wpndata)*MAXWPNS,memrequested,-1,-1)); | |
| 1328 | |||
| 1329 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if((wpnsbuf=(wpndata*)malloc(sizeof(wpndata)*MAXWPNS))==NULL) |
| 1330 | ✗ | return 0; | |
| 1331 | |||
| 1332 | 14 | memset(wpnsbuf,0,sizeof(wpndata)*MAXWPNS); | |
| 1333 | 14 | Z_message("OK\n"); // Allocating weapon buffer... | |
| 1334 | |||
| 1335 | 14 | memrequested+=(sizeof(guydata)*MAXGUYS); | |
| 1336 | 14 | Z_message("Allocating guy buffer (%s)... ", byte_conversion2(sizeof(guydata)*MAXGUYS,memrequested,-1,-1)); | |
| 1337 | |||
| 1338 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if((guysbuf=(guydata*)malloc(sizeof(guydata)*MAXGUYS))==NULL) |
| 1339 | ✗ | return 0; | |
| 1340 | |||
| 1341 | 14 | memset(guysbuf,0,sizeof(guydata)*MAXGUYS); | |
| 1342 | 14 | Z_message("OK\n"); // Allocating guy buffer... | |
| 1343 | |||
| 1344 | 14 | memrequested+=(sizeof(comboclass)*cMAX); | |
| 1345 | 14 | Z_message("Allocating combo class buffer (%s)... ", byte_conversion2(sizeof(comboclass)*cMAX,memrequested,-1,-1)); | |
| 1346 | |||
| 1347 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if((combo_class_buf=(comboclass*)malloc(sizeof(comboclass)*cMAX))==NULL) |
| 1348 | ✗ | return 0; | |
| 1349 | |||
| 1350 | 14 | Z_message("OK\n"); // Allocating combo class buffer... | |
| 1351 | |||
| 1352 | 14 | return 1; | |
| 1353 | 14 | } | |
| 1354 | |||
| 1355 | |||
| 1356 | 14 | void free_newtilebuf() | |
| 1357 | { | ||
| 1358 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if(newtilebuf) |
| 1359 | { | ||
| 1360 | ✗ | for(int32_t i=0; i<NEWMAXTILES; i++) | |
| 1361 | ✗ | if(newtilebuf[i].data) | |
| 1362 | ✗ | free(newtilebuf[i].data); | |
| 1363 | |||
| 1364 | ✗ | free(newtilebuf); | |
| 1365 | ✗ | newtilebuf = 0; | |
| 1366 | } | ||
| 1367 | 14 | } | |
| 1368 | |||
| 1369 | ✗ | void free_grabtilebuf() | |
| 1370 | { | ||
| 1371 | ✗ | if(is_zquest()) | |
| 1372 | { | ||
| 1373 | ✗ | if(grabtilebuf) | |
| 1374 | { | ||
| 1375 | ✗ | for(int32_t i=0; i<NEWMAXTILES; i++) | |
| 1376 | ✗ | if(grabtilebuf[i].data) free(grabtilebuf[i].data); | |
| 1377 | |||
| 1378 | ✗ | free(grabtilebuf); | |
| 1379 | ✗ | grabtilebuf = 0; | |
| 1380 | } | ||
| 1381 | } | ||
| 1382 | } | ||
| 1383 | |||
| 1384 | ✗ | void del_qst_buffers() | |
| 1385 | { | ||
| 1386 | ✗ | al_trace("Cleaning maps. \n"); | |
| 1387 | |||
| 1388 | ✗ | if(ZCMaps) free(ZCMaps); | |
| 1389 | |||
| 1390 | ✗ | if(MsgStrings) delete[] MsgStrings; | |
| 1391 | |||
| 1392 | ✗ | if(DoorComboSets) free(DoorComboSets); | |
| 1393 | |||
| 1394 | ✗ | if(DMaps) free(DMaps); | |
| 1395 | |||
| 1396 | ✗ | if(combobuf) free(combobuf); | |
| 1397 | |||
| 1398 | ✗ | if(colordata) free(colordata); | |
| 1399 | |||
| 1400 | ✗ | al_trace("Cleaning tile buffers. \n"); | |
| 1401 | ✗ | free_newtilebuf(); | |
| 1402 | ✗ | free_grabtilebuf(); | |
| 1403 | |||
| 1404 | ✗ | al_trace("Cleaning misc. \n"); | |
| 1405 | |||
| 1406 | ✗ | if(trashbuf) free(trashbuf); | |
| 1407 | |||
| 1408 | // See get_qst_buffers | ||
| 1409 | ✗ | if(itemsbuf) | |
| 1410 | { | ||
| 1411 | ✗ | itemsbuf--; | |
| 1412 | ✗ | free(itemsbuf); | |
| 1413 | } | ||
| 1414 | |||
| 1415 | ✗ | if(wpnsbuf) free(wpnsbuf); | |
| 1416 | |||
| 1417 | ✗ | if(guysbuf) free(guysbuf); | |
| 1418 | |||
| 1419 | ✗ | if(combo_class_buf) free(combo_class_buf); | |
| 1420 | } | ||
| 1421 | |||
| 1422 | ✗ | bool init_palnames() | |
| 1423 | { | ||
| 1424 | // if(palnames==NULL) | ||
| 1425 | // return false; | ||
| 1426 | |||
| 1427 | ✗ | for(int32_t x=0; x<MAXLEVELS; x++) | |
| 1428 | { | ||
| 1429 | ✗ | switch(x) | |
| 1430 | { | ||
| 1431 | case 0: | ||
| 1432 | ✗ | sprintf(palnames[x],"Overworld"); | |
| 1433 | ✗ | break; | |
| 1434 | |||
| 1435 | case 10: | ||
| 1436 | ✗ | sprintf(palnames[x],"Caves"); | |
| 1437 | ✗ | break; | |
| 1438 | |||
| 1439 | case 11: | ||
| 1440 | ✗ | sprintf(palnames[x],"Passageways"); | |
| 1441 | ✗ | break; | |
| 1442 | |||
| 1443 | default: | ||
| 1444 | ✗ | sprintf(palnames[x],"%c",0); | |
| 1445 | ✗ | break; | |
| 1446 | } | ||
| 1447 | } | ||
| 1448 | |||
| 1449 | ✗ | return true; | |
| 1450 | } | ||
| 1451 | |||
| 1452 | 17122 | static void *read_block(PACKFILE *f, int32_t size, int32_t alloc_size, bool keepdata) | |
| 1453 | { | ||
| 1454 | void *p; | ||
| 1455 | |||
| 1456 |
1/2✓ Branch 0 taken 17122 times.
✗ Branch 1 not taken.
|
17122 | p = _AL_MALLOC(MAX(size, alloc_size)); |
| 1457 | |||
| 1458 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17122 times.
|
17122 | if(!p) |
| 1459 | { | ||
| 1460 | ✗ | return NULL; | |
| 1461 | } | ||
| 1462 | |||
| 1463 |
1/2✓ Branch 0 taken 17122 times.
✗ Branch 1 not taken.
|
17122 | if(!pfread(p,size,f,keepdata)) |
| 1464 | { | ||
| 1465 | ✗ | _AL_FREE(p); | |
| 1466 | ✗ | return NULL; | |
| 1467 | } | ||
| 1468 | |||
| 1469 |
1/2✓ Branch 0 taken 17122 times.
✗ Branch 1 not taken.
|
17122 | if(pack_ferror(f)) |
| 1470 | { | ||
| 1471 | ✗ | _AL_FREE(p); | |
| 1472 | ✗ | return NULL; | |
| 1473 | } | ||
| 1474 | |||
| 1475 | 17122 | return p; | |
| 1476 | 17122 | } | |
| 1477 | |||
| 1478 | /* read_midi: | ||
| 1479 | * Reads MIDI data from a datafile (this is not the same thing as the | ||
| 1480 | * standard midi file format). | ||
| 1481 | */ | ||
| 1482 | |||
| 1483 | 1447 | static MIDI *read_midi(PACKFILE *f, bool) | |
| 1484 | { | ||
| 1485 | MIDI *m; | ||
| 1486 | int32_t c; | ||
| 1487 | 1447 | int16_t divisions=0; | |
| 1488 | 1447 | int32_t len=0; | |
| 1489 | |||
| 1490 | 1447 | m = (MIDI*)_AL_MALLOC(sizeof(MIDI)); | |
| 1491 | |||
| 1492 |
1/2✓ Branch 0 taken 1447 times.
✗ Branch 1 not taken.
|
1447 | if(!m) |
| 1493 | { | ||
| 1494 | ✗ | return NULL; | |
| 1495 | } | ||
| 1496 | |||
| 1497 |
2/2✓ Branch 0 taken 46304 times.
✓ Branch 1 taken 1447 times.
|
47751 | for(c=0; c<MIDI_TRACKS; c++) |
| 1498 | { | ||
| 1499 | 46304 | m->track[c].len = 0; | |
| 1500 | 46304 | m->track[c].data = NULL; | |
| 1501 | 46304 | } | |
| 1502 | |||
| 1503 | 1447 | p_mgetw(&divisions,f,true); | |
| 1504 | 1447 | m->divisions=divisions; | |
| 1505 | |||
| 1506 |
2/2✓ Branch 0 taken 46304 times.
✓ Branch 1 taken 1447 times.
|
47751 | for(c=0; c<MIDI_TRACKS; c++) |
| 1507 | { | ||
| 1508 | 46304 | p_mgetl(&len,f,true); | |
| 1509 | 46304 | m->track[c].len=len; | |
| 1510 | |||
| 1511 |
2/2✓ Branch 0 taken 29182 times.
✓ Branch 1 taken 17122 times.
|
46304 | if(m->track[c].len > 0) |
| 1512 | { | ||
| 1513 | 17122 | m->track[c].data = (byte*)read_block(f, m->track[c].len, 0, true); | |
| 1514 | |||
| 1515 |
1/2✓ Branch 0 taken 17122 times.
✗ Branch 1 not taken.
|
17122 | if(!m->track[c].data) |
| 1516 | { | ||
| 1517 | ✗ | destroy_midi(m); | |
| 1518 | ✗ | return NULL; | |
| 1519 | } | ||
| 1520 | 17122 | } | |
| 1521 | 46304 | } | |
| 1522 | |||
| 1523 | LOCK_DATA(m, sizeof(MIDI)); | ||
| 1524 | |||
| 1525 |
2/2✓ Branch 0 taken 46304 times.
✓ Branch 1 taken 1447 times.
|
47751 | for(c=0; c<MIDI_TRACKS; c++) |
| 1526 | { | ||
| 1527 |
2/2✓ Branch 0 taken 17122 times.
✓ Branch 1 taken 29182 times.
|
46304 | if(m->track[c].data) |
| 1528 | { | ||
| 1529 | LOCK_DATA(m->track[c].data, m->track[c].len); | ||
| 1530 | 17122 | } | |
| 1531 | 46304 | } | |
| 1532 | |||
| 1533 | 1447 | return m; | |
| 1534 | 1447 | } | |
| 1535 | |||
| 1536 | ✗ | void clear_combo(int32_t i) | |
| 1537 | { | ||
| 1538 | ✗ | combobuf[i].clear(); | |
| 1539 | } | ||
| 1540 | |||
| 1541 | ✗ | void clear_combos() | |
| 1542 | { | ||
| 1543 | ✗ | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) | |
| 1544 | ✗ | clear_combo(tmpcounter); | |
| 1545 | } | ||
| 1546 | |||
| 1547 | ✗ | void pack_combos() | |
| 1548 | { | ||
| 1549 | ✗ | int32_t di = 0; | |
| 1550 | |||
| 1551 | ✗ | for(int32_t si=0; si<1024; si+=2) | |
| 1552 | ✗ | combobuf[di++] = combobuf[si]; | |
| 1553 | |||
| 1554 | ✗ | for(; di<1024; di++) | |
| 1555 | ✗ | clear_combo(di); | |
| 1556 | } | ||
| 1557 | |||
| 1558 | 77 | void reset_tunes(zctune *tune) | |
| 1559 | { | ||
| 1560 |
2/2✓ Branch 0 taken 19404 times.
✓ Branch 1 taken 77 times.
|
19481 | for(int32_t i=0; i<MAXCUSTOMTUNES; i++) |
| 1561 | { | ||
| 1562 | 19404 | tune[i].reset(); | |
| 1563 | 19404 | } | |
| 1564 | 77 | } | |
| 1565 | |||
| 1566 | |||
| 1567 | /*void reset_midi(zcmidi_ *m) | ||
| 1568 | { | ||
| 1569 | m->title[0]=0; | ||
| 1570 | m->loop=1; | ||
| 1571 | m->volume=144; | ||
| 1572 | m->start=0; | ||
| 1573 | m->loop_start=-1; | ||
| 1574 | m->loop_end=-1; | ||
| 1575 | if(m->midi) | ||
| 1576 | { | ||
| 1577 | destroy_midi(m->midi); | ||
| 1578 | } | ||
| 1579 | m->midi=NULL; | ||
| 1580 | } | ||
| 1581 | |||
| 1582 | |||
| 1583 | void reset_midis(zcmidi_ *m) | ||
| 1584 | { | ||
| 1585 | for(int32_t i=0; i<MAXCUSTOMMIDIS; i++) | ||
| 1586 | { | ||
| 1587 | reset_midi(m+i); | ||
| 1588 | } | ||
| 1589 | } | ||
| 1590 | */ | ||
| 1591 | |||
| 1592 | ✗ | void reset_scr(int32_t scr) | |
| 1593 | { | ||
| 1594 | /* | ||
| 1595 | byte *di=((byte*)TheMaps)+(scr*sizeof(mapscr)); | ||
| 1596 | for(unsigned i=0; i<sizeof(mapscr); i++) | ||
| 1597 | *(di++) = 0; | ||
| 1598 | TheMaps[scr].valid=mVERSION; | ||
| 1599 | */ | ||
| 1600 | |||
| 1601 | ✗ | TheMaps[scr].zero_memory(); | |
| 1602 | //byte *di=((byte*)TheMaps)+(scr*sizeof(mapscr)); | ||
| 1603 | |||
| 1604 | ✗ | for(int32_t i=0; i<6; i++) | |
| 1605 | { | ||
| 1606 | //these will be uncommented later | ||
| 1607 | //TheMaps[scr].layerxsize[i]=16; | ||
| 1608 | //TheMaps[scr].layerysize[i]=11; | ||
| 1609 | ✗ | TheMaps[scr].layeropacity[i]=255; | |
| 1610 | } | ||
| 1611 | |||
| 1612 | ✗ | TheMaps[scr].valid=mVERSION; | |
| 1613 | |||
| 1614 | } | ||
| 1615 | |||
| 1616 | /* For reference: | ||
| 1617 | |||
| 1618 | enum { qe_OK, qe_notfound, qe_invalid, qe_version, qe_obsolete, | ||
| 1619 | qe_missing, qe_internal, qe_pwd, qe_match, qe_minver }; | ||
| 1620 | */ | ||
| 1621 | |||
| 1622 | ✗ | int32_t operator ==(DoorComboSet a, DoorComboSet b) | |
| 1623 | { | ||
| 1624 | ✗ | for(int32_t i=0; i<9; i++) | |
| 1625 | { | ||
| 1626 | ✗ | for(int32_t j=0; j<6; j++) | |
| 1627 | { | ||
| 1628 | ✗ | if(j<4) | |
| 1629 | { | ||
| 1630 | ✗ | if(a.doorcombo_u[i][j]!=b.doorcombo_u[i][j]) | |
| 1631 | { | ||
| 1632 | ✗ | return false; | |
| 1633 | } | ||
| 1634 | |||
| 1635 | ✗ | if(a.doorcset_u[i][j]!=b.doorcset_u[i][j]) | |
| 1636 | { | ||
| 1637 | ✗ | return false; | |
| 1638 | } | ||
| 1639 | |||
| 1640 | ✗ | if(a.doorcombo_d[i][j]!=b.doorcombo_d[i][j]) | |
| 1641 | { | ||
| 1642 | ✗ | return false; | |
| 1643 | } | ||
| 1644 | |||
| 1645 | ✗ | if(a.doorcset_d[i][j]!=b.doorcset_d[i][j]) | |
| 1646 | { | ||
| 1647 | ✗ | return false; | |
| 1648 | } | ||
| 1649 | } | ||
| 1650 | |||
| 1651 | ✗ | if(a.doorcombo_l[i][j]!=b.doorcombo_l[i][j]) | |
| 1652 | { | ||
| 1653 | ✗ | return false; | |
| 1654 | } | ||
| 1655 | |||
| 1656 | ✗ | if(a.doorcset_l[i][j]!=b.doorcset_l[i][j]) | |
| 1657 | { | ||
| 1658 | ✗ | return false; | |
| 1659 | } | ||
| 1660 | |||
| 1661 | ✗ | if(a.doorcombo_r[i][j]!=b.doorcombo_r[i][j]) | |
| 1662 | { | ||
| 1663 | ✗ | return false; | |
| 1664 | } | ||
| 1665 | |||
| 1666 | ✗ | if(a.doorcset_r[i][j]!=b.doorcset_r[i][j]) | |
| 1667 | { | ||
| 1668 | ✗ | return false; | |
| 1669 | } | ||
| 1670 | } | ||
| 1671 | |||
| 1672 | ✗ | if(i<2) | |
| 1673 | { | ||
| 1674 | ✗ | if(a.flags[i]!=b.flags[i]) | |
| 1675 | { | ||
| 1676 | ✗ | return false; | |
| 1677 | } | ||
| 1678 | |||
| 1679 | ✗ | if(a.bombdoorcombo_u[i]!=b.bombdoorcombo_u[i]) | |
| 1680 | { | ||
| 1681 | ✗ | return false; | |
| 1682 | } | ||
| 1683 | |||
| 1684 | ✗ | if(a.bombdoorcset_u[i]!=b.bombdoorcset_u[i]) | |
| 1685 | { | ||
| 1686 | ✗ | return false; | |
| 1687 | } | ||
| 1688 | |||
| 1689 | ✗ | if(a.bombdoorcombo_d[i]!=b.bombdoorcombo_d[i]) | |
| 1690 | { | ||
| 1691 | ✗ | return false; | |
| 1692 | } | ||
| 1693 | |||
| 1694 | ✗ | if(a.bombdoorcset_d[i]!=b.bombdoorcset_d[i]) | |
| 1695 | { | ||
| 1696 | ✗ | return false; | |
| 1697 | } | ||
| 1698 | } | ||
| 1699 | |||
| 1700 | ✗ | if(i<3) | |
| 1701 | { | ||
| 1702 | ✗ | if(a.bombdoorcombo_l[i]!=b.bombdoorcombo_l[i]) | |
| 1703 | { | ||
| 1704 | ✗ | return false; | |
| 1705 | } | ||
| 1706 | |||
| 1707 | ✗ | if(a.bombdoorcset_l[i]!=b.bombdoorcset_l[i]) | |
| 1708 | { | ||
| 1709 | ✗ | return false; | |
| 1710 | } | ||
| 1711 | |||
| 1712 | ✗ | if(a.bombdoorcombo_r[i]!=b.bombdoorcombo_r[i]) | |
| 1713 | { | ||
| 1714 | ✗ | return false; | |
| 1715 | } | ||
| 1716 | |||
| 1717 | ✗ | if(a.bombdoorcset_r[i]!=b.bombdoorcset_r[i]) | |
| 1718 | { | ||
| 1719 | ✗ | return false; | |
| 1720 | } | ||
| 1721 | } | ||
| 1722 | |||
| 1723 | ✗ | if(a.walkthroughcombo[i]!=b.walkthroughcombo[i]) | |
| 1724 | { | ||
| 1725 | ✗ | return false; | |
| 1726 | } | ||
| 1727 | |||
| 1728 | ✗ | if(a.walkthroughcset[i]!=b.walkthroughcset[i]) | |
| 1729 | { | ||
| 1730 | ✗ | return false; | |
| 1731 | } | ||
| 1732 | } | ||
| 1733 | |||
| 1734 | ✗ | return true; | |
| 1735 | } | ||
| 1736 | |||
| 1737 | int32_t doortranslations_u[9][4]= | ||
| 1738 | { | ||
| 1739 | {37,38,53,54}, | ||
| 1740 | {37,38,39,40}, | ||
| 1741 | {37,38,55,56}, | ||
| 1742 | {37,38,39,40}, | ||
| 1743 | {37,38,53,54}, | ||
| 1744 | {37,38,53,54}, | ||
| 1745 | {37,38,53,54}, | ||
| 1746 | {7,8,23,24}, | ||
| 1747 | {7,8,41,42} | ||
| 1748 | }; | ||
| 1749 | |||
| 1750 | int32_t doortranslations_d[9][4]= | ||
| 1751 | { | ||
| 1752 | {117,118,133,134}, | ||
| 1753 | {135,136,133,134}, | ||
| 1754 | {119,120,133,134}, | ||
| 1755 | {135,136,133,134}, | ||
| 1756 | {117,118,133,134}, | ||
| 1757 | {117,118,133,134}, | ||
| 1758 | {117,118,133,134}, | ||
| 1759 | {151,152,167,168}, | ||
| 1760 | {137,138,167,168}, | ||
| 1761 | }; | ||
| 1762 | |||
| 1763 | //enum {dt_pass=0, dt_lock, dt_shut, dt_boss, dt_olck, dt_osht, dt_obos, dt_wall, dt_bomb, dt_walk, dt_max}; | ||
| 1764 | int32_t doortranslations_l[9][6]= | ||
| 1765 | { | ||
| 1766 | {66,67,82,83,98,99}, | ||
| 1767 | {66,68,82,84,98,100}, | ||
| 1768 | {66,69,82,85,98,101}, | ||
| 1769 | {66,68,82,84,98,100}, | ||
| 1770 | {66,67,82,83,98,99}, | ||
| 1771 | {66,67,82,83,98,99}, | ||
| 1772 | {66,67,82,83,98,99}, | ||
| 1773 | {64,65,80,81,96,97}, | ||
| 1774 | {64,65,80,114,96,97}, | ||
| 1775 | }; | ||
| 1776 | |||
| 1777 | int32_t doortranslations_r[9][6]= | ||
| 1778 | { | ||
| 1779 | |||
| 1780 | {76,77,92,93,108,109}, | ||
| 1781 | {75,77,91,93,107,109}, | ||
| 1782 | {74,77,90,93,106,109}, | ||
| 1783 | {75,77,91,93,107,109}, | ||
| 1784 | {76,77,92,93,108,109}, | ||
| 1785 | {76,77,92,93,108,109}, | ||
| 1786 | {76,77,92,93,108,109}, | ||
| 1787 | {78,79,94,95,110,111}, | ||
| 1788 | {78,79,125,95,110,111}, | ||
| 1789 | }; | ||
| 1790 | |||
| 1791 | ✗ | int32_t tdcmbdat(int32_t map, int32_t scr, int32_t pos) | |
| 1792 | { | ||
| 1793 | ✗ | return (TheMaps[map*MAPSCRS+TEMPLATE].data[pos]&0xFF)+((TheMaps[map*MAPSCRS+scr].old_cpage)<<8); | |
| 1794 | } | ||
| 1795 | |||
| 1796 | ✗ | int32_t tdcmbcset(int32_t map, int32_t scr, int32_t pos) | |
| 1797 | { | ||
| 1798 | //these are here to bypass compiler warnings about unused arguments | ||
| 1799 | ✗ | map=map; | |
| 1800 | ✗ | scr=scr; | |
| 1801 | ✗ | pos=pos; | |
| 1802 | |||
| 1803 | //what does this function do? | ||
| 1804 | // return TheMaps[map*MAPSCRS+TEMPLATE].cset[pos]; | ||
| 1805 | ✗ | return 2; | |
| 1806 | } | ||
| 1807 | |||
| 1808 | ✗ | int32_t MakeDoors(int32_t map, int32_t scr) | |
| 1809 | { | ||
| 1810 | ✗ | if(!(TheMaps[map*MAPSCRS+scr].valid&mVALID)) | |
| 1811 | { | ||
| 1812 | ✗ | return 0; | |
| 1813 | } | ||
| 1814 | |||
| 1815 | DoorComboSet tempdcs; | ||
| 1816 | ✗ | memset(&tempdcs, 0, sizeof(DoorComboSet)); | |
| 1817 | |||
| 1818 | //up | ||
| 1819 | ✗ | for(int32_t i=0; i<9; i++) | |
| 1820 | { | ||
| 1821 | ✗ | for(int32_t j=0; j<4; j++) | |
| 1822 | { | ||
| 1823 | ✗ | tempdcs.doorcombo_u[i][j]=tdcmbdat(map,scr,doortranslations_u[i][j]); | |
| 1824 | ✗ | tempdcs.doorcset_u[i][j]=tdcmbcset(map,scr,doortranslations_u[i][j]); | |
| 1825 | } | ||
| 1826 | } | ||
| 1827 | |||
| 1828 | ✗ | tempdcs.bombdoorcombo_u[0]=tdcmbdat(map,scr,57); | |
| 1829 | ✗ | tempdcs.bombdoorcset_u[0]=tdcmbcset(map,scr,57); | |
| 1830 | ✗ | tempdcs.bombdoorcombo_u[1]=tdcmbdat(map,scr,58); | |
| 1831 | ✗ | tempdcs.bombdoorcset_u[1]=tdcmbcset(map,scr,58); | |
| 1832 | ✗ | tempdcs.walkthroughcombo[0]=tdcmbdat(map,scr,34); | |
| 1833 | ✗ | tempdcs.walkthroughcset[0]=tdcmbdat(map,scr,34); | |
| 1834 | |||
| 1835 | //down | ||
| 1836 | ✗ | for(int32_t i=0; i<9; i++) | |
| 1837 | { | ||
| 1838 | ✗ | for(int32_t j=0; j<4; j++) | |
| 1839 | { | ||
| 1840 | ✗ | tempdcs.doorcombo_d[i][j]=tdcmbdat(map,scr,doortranslations_d[i][j]); | |
| 1841 | ✗ | tempdcs.doorcset_d[i][j]=tdcmbcset(map,scr,doortranslations_d[i][j]); | |
| 1842 | } | ||
| 1843 | } | ||
| 1844 | |||
| 1845 | ✗ | tempdcs.bombdoorcombo_d[0]=tdcmbdat(map,scr,121); | |
| 1846 | |||
| 1847 | ✗ | tempdcs.bombdoorcset_d[0]=tdcmbcset(map,scr,121); | |
| 1848 | ✗ | tempdcs.bombdoorcombo_d[1]=tdcmbdat(map,scr,122); | |
| 1849 | ✗ | tempdcs.bombdoorcset_d[1]=tdcmbcset(map,scr,122); | |
| 1850 | ✗ | tempdcs.walkthroughcombo[1]=tdcmbdat(map,scr,34); | |
| 1851 | ✗ | tempdcs.walkthroughcset[1]=tdcmbdat(map,scr,34); | |
| 1852 | |||
| 1853 | //left | ||
| 1854 | // TheMaps[i*MAPSCRS+j].warpdmap=TheOldMap.warpdmap; | ||
| 1855 | ✗ | for(int32_t i=0; i<9; i++) | |
| 1856 | { | ||
| 1857 | ✗ | for(int32_t j=0; j<6; j++) | |
| 1858 | { | ||
| 1859 | ✗ | tempdcs.doorcombo_l[i][j]=tdcmbdat(map,scr,doortranslations_l[i][j]); | |
| 1860 | ✗ | tempdcs.doorcset_l[i][j]=tdcmbcset(map,scr,doortranslations_l[i][j]); | |
| 1861 | } | ||
| 1862 | } | ||
| 1863 | |||
| 1864 | ✗ | for(int32_t j=0; j>6; j++) | |
| 1865 | { | ||
| 1866 | ✗ | if((j!=2)&&(j!=3)) | |
| 1867 | { | ||
| 1868 | ✗ | tempdcs.doorcombo_l[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].data[doortranslations_l[dt_bomb][j]]; | |
| 1869 | ✗ | tempdcs.doorcset_l[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].cset[doortranslations_l[dt_bomb][j]]; | |
| 1870 | } | ||
| 1871 | } | ||
| 1872 | |||
| 1873 | ✗ | tempdcs.bombdoorcombo_l[0]=0; | |
| 1874 | ✗ | tempdcs.bombdoorcset_l[0]=tdcmbcset(map,scr,115); | |
| 1875 | ✗ | tempdcs.bombdoorcombo_l[1]=tdcmbdat(map,scr,115); | |
| 1876 | ✗ | tempdcs.bombdoorcset_l[1]=tdcmbcset(map,scr,115); | |
| 1877 | ✗ | tempdcs.bombdoorcombo_l[2]=0; | |
| 1878 | ✗ | tempdcs.bombdoorcset_l[2]=tdcmbcset(map,scr,115); | |
| 1879 | ✗ | tempdcs.walkthroughcombo[2]=tdcmbdat(map,scr,34); | |
| 1880 | ✗ | tempdcs.walkthroughcset[2]=tdcmbdat(map,scr,34); | |
| 1881 | |||
| 1882 | //right | ||
| 1883 | ✗ | for(int32_t i=0; i<9; i++) | |
| 1884 | { | ||
| 1885 | ✗ | for(int32_t j=0; j<6; j++) | |
| 1886 | { | ||
| 1887 | ✗ | tempdcs.doorcombo_r[i][j]=tdcmbdat(map,scr,doortranslations_r[i][j]); | |
| 1888 | ✗ | tempdcs.doorcset_r[i][j]=tdcmbcset(map,scr,doortranslations_r[i][j]); | |
| 1889 | } | ||
| 1890 | } | ||
| 1891 | |||
| 1892 | ✗ | for(int32_t j=0; j>6; j++) | |
| 1893 | { | ||
| 1894 | ✗ | if((j!=2)&&(j!=3)) | |
| 1895 | { | ||
| 1896 | ✗ | tempdcs.doorcombo_r[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].data[doortranslations_r[dt_bomb][j]]; | |
| 1897 | ✗ | tempdcs.doorcset_r[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].cset[doortranslations_r[dt_bomb][j]]; | |
| 1898 | } | ||
| 1899 | } | ||
| 1900 | |||
| 1901 | ✗ | tempdcs.bombdoorcombo_r[0]=0; | |
| 1902 | ✗ | tempdcs.bombdoorcset_r[0]=tdcmbcset(map,scr,124); | |
| 1903 | ✗ | tempdcs.bombdoorcombo_r[1]=tdcmbdat(map,scr,124); | |
| 1904 | ✗ | tempdcs.bombdoorcset_r[1]=tdcmbcset(map,scr,124); | |
| 1905 | ✗ | tempdcs.bombdoorcombo_r[2]=0; | |
| 1906 | ✗ | tempdcs.bombdoorcset_r[2]=tdcmbcset(map,scr,124); | |
| 1907 | ✗ | tempdcs.walkthroughcombo[3]=tdcmbdat(map,scr,34); | |
| 1908 | ✗ | tempdcs.walkthroughcset[3]=tdcmbdat(map,scr,34); | |
| 1909 | |||
| 1910 | int32_t k; | ||
| 1911 | |||
| 1912 | ✗ | for(k=0; k<door_combo_set_count; k++) | |
| 1913 | { | ||
| 1914 | ✗ | if(DoorComboSets[k]==tempdcs) | |
| 1915 | { | ||
| 1916 | ✗ | break; | |
| 1917 | } | ||
| 1918 | } | ||
| 1919 | |||
| 1920 | ✗ | if(k==door_combo_set_count) | |
| 1921 | { | ||
| 1922 | ✗ | DoorComboSets[k]=tempdcs; | |
| 1923 | ✗ | sprintf(DoorComboSets[k].name, "Door Combo Set %d", k); | |
| 1924 | ✗ | ++door_combo_set_count; | |
| 1925 | } | ||
| 1926 | |||
| 1927 | ✗ | return k; | |
| 1928 | /* | ||
| 1929 | doorcombo_u[9][4]; | ||
| 1930 | doorcset_u[9][4]; | ||
| 1931 | doorcombo_d[9][4]; | ||
| 1932 | doorcset_d[9][4]; | ||
| 1933 | doorcombo_l[9][6]; | ||
| 1934 | doorcset_l[9][6]; | ||
| 1935 | doorcombo_r[9][6]; | ||
| 1936 | doorcset_r[9][6]; | ||
| 1937 | bombdoorcombo_u[2]; | ||
| 1938 | bombdoorcset_u[2]; | ||
| 1939 | bombdoorcombo_d[2]; | ||
| 1940 | bombdoorcset_d[2]; | ||
| 1941 | bombdoorcombo_l[3]; | ||
| 1942 | bombdoorcset_l[3]; | ||
| 1943 | bombdoorcombo_r[3]; | ||
| 1944 | bombdoorcset_r[3]; | ||
| 1945 | walkthroughcombo[4]; | ||
| 1946 | walkthroughcset[4]; | ||
| 1947 | */ | ||
| 1948 | } | ||
| 1949 | |||
| 1950 | ✗ | INLINE int32_t tcmbdat2(int32_t map, int32_t scr, int32_t pos) | |
| 1951 | { | ||
| 1952 | ✗ | return (TheMaps[map*MAPSCRS+TEMPLATE2].data[pos]&0xFF)+((TheMaps[map*MAPSCRS+scr].old_cpage)<<8); | |
| 1953 | } | ||
| 1954 | |||
| 1955 | ✗ | INLINE int32_t tcmbcset2(int32_t map, int32_t pos) | |
| 1956 | { | ||
| 1957 | |||
| 1958 | ✗ | return TheMaps[map*MAPSCRS+TEMPLATE2].cset[pos]; | |
| 1959 | } | ||
| 1960 | |||
| 1961 | ✗ | INLINE int32_t tcmbflag2(int32_t map, int32_t pos) | |
| 1962 | { | ||
| 1963 | ✗ | return TheMaps[map*MAPSCRS+TEMPLATE2].sflag[pos]; | |
| 1964 | } | ||
| 1965 | |||
| 1966 | |||
| 1967 | ✗ | void get_questpwd(char *encrypted_pwd, int16_t pwdkey, char *pwd) | |
| 1968 | { | ||
| 1969 | char temp_pwd[30]; | ||
| 1970 | ✗ | memset(temp_pwd,0,30); | |
| 1971 | |||
| 1972 | ✗ | if(pwdkey!=0) | |
| 1973 | { | ||
| 1974 | ✗ | memcpy(temp_pwd,encrypted_pwd,30); | |
| 1975 | ✗ | temp_pwd[29]=0; | |
| 1976 | |||
| 1977 | ✗ | for(int32_t i=0; i<30; i++) | |
| 1978 | { | ||
| 1979 | ✗ | temp_pwd[i] -= pwdkey; | |
| 1980 | ✗ | int32_t t=pwdkey>>15; | |
| 1981 | ✗ | pwdkey = (pwdkey<<1)+t; | |
| 1982 | } | ||
| 1983 | } | ||
| 1984 | |||
| 1985 | ✗ | memcpy(pwd,temp_pwd,30); | |
| 1986 | } | ||
| 1987 | |||
| 1988 | |||
| 1989 | |||
| 1990 | ✗ | bool check_questpwd(zquestheader *Header, char *pwd) | |
| 1991 | { | ||
| 1992 | #if DEVLEVEL > 3 | ||
| 1993 | return true; | ||
| 1994 | #endif | ||
| 1995 | |||
| 1996 | ✗ | if ( (!strcmp(pwd, (char*)clavio)) ) return true; | |
| 1997 | cvs_MD5Context ctx; | ||
| 1998 | uint8_t md5sum[16]; | ||
| 1999 | |||
| 2000 | ✗ | cvs_MD5Init(&ctx); | |
| 2001 | ✗ | cvs_MD5Update(&ctx, (const uint8_t*)pwd, (unsigned)strlen(pwd)); | |
| 2002 | ✗ | cvs_MD5Final(md5sum, &ctx); | |
| 2003 | |||
| 2004 | ✗ | return (memcmp(Header->pwd_hash,md5sum,16)==0); | |
| 2005 | |||
| 2006 | } | ||
| 2007 | |||
| 2008 | 74 | void print_quest_metadata(zquestheader const& tempheader, char const* path, byte qst_num) | |
| 2009 | { | ||
| 2010 | 74 | zprint2("\n"); | |
| 2011 | 74 | zprint2("[ZQUEST CREATOR METADATA]\n"); | |
| 2012 |
1/2✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
|
74 | if(qst_num < moduledata.max_quest_files) |
| 2013 | ✗ | zprint2("Loading module quest %d\n", qst_num+1); | |
| 2014 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 74 times.
|
74 | if(path) zprint2("Loading '%s'\n", path); |
| 2015 |
1/2✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
|
74 | if ( tempheader.new_version_id_main > 0 ) |
| 2016 | { | ||
| 2017 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 74 times.
|
74 | if(tempheader.new_version_id_fourth > 0) |
| 2018 | ✗ | zprint2("Last saved in ZQuest Version %d.%d.%d.%d ", | |
| 2019 | ✗ | tempheader.new_version_id_main,tempheader.new_version_id_second, | |
| 2020 | ✗ | tempheader.new_version_id_third,tempheader.new_version_id_fourth); | |
| 2021 | 74 | else zprint2("Last saved in ZQuest Version: %d.%d.%d ", | |
| 2022 | 74 | tempheader.new_version_id_main,tempheader.new_version_id_second, | |
| 2023 | 74 | tempheader.new_version_id_third); | |
| 2024 | 74 | } | |
| 2025 | else | ||
| 2026 | { | ||
| 2027 | ✗ | switch ( tempheader.zelda_version ) | |
| 2028 | { | ||
| 2029 | case 0x255: | ||
| 2030 | { | ||
| 2031 | ✗ | zprint2("Last saved in ZQuest Version: 2.55.0, %s: %d", tempheader.getAlphaStr(), tempheader.getAlphaVer()); | |
| 2032 | ✗ | break; | |
| 2033 | } | ||
| 2034 | case 0x254: | ||
| 2035 | { | ||
| 2036 | ✗ | zprint2("Last saved in ZQuest Version: 2.54.0, Alpha Build ID: %d", tempheader.build); | |
| 2037 | ✗ | break; | |
| 2038 | } | ||
| 2039 | case 0x250: | ||
| 2040 | { | ||
| 2041 | ✗ | switch(tempheader.build) | |
| 2042 | { | ||
| 2043 | case 19: | ||
| 2044 | ✗ | zprint2("Last saved in ZQuest Version: 2.50.0, Gamma 1"); break; | |
| 2045 | case 20: | ||
| 2046 | ✗ | zprint2("Last saved in ZQuest Version: 2.50.0, Gamma 2"); break; | |
| 2047 | case 21: | ||
| 2048 | ✗ | zprint2("Last saved in ZQuest Version: 2.50.0, Gamma 3"); break; | |
| 2049 | case 22: | ||
| 2050 | ✗ | zprint2("Last saved in ZQuest Version: 2.50.0, Gamma 4"); break; | |
| 2051 | case 23: | ||
| 2052 | ✗ | zprint2("Last saved in ZQuest Version: 2.50.0, Gamma 5"); break; | |
| 2053 | case 24: | ||
| 2054 | ✗ | zprint2("Last saved in ZQuest Version: 2.50.0, Release"); break; | |
| 2055 | case 25: | ||
| 2056 | ✗ | zprint2("Last saved in ZQuest Version: 2.50.1, Gamma 1"); break; | |
| 2057 | case 26: | ||
| 2058 | ✗ | zprint2("Last saved in ZQuest Version: 2.50.1, Gamma 2"); break; | |
| 2059 | case 27: | ||
| 2060 | ✗ | zprint2("Last saved in ZQuest Version: 2.50.1, Gamma 3"); break; | |
| 2061 | case 28: | ||
| 2062 | ✗ | zprint2("Last saved in ZQuest Version: 2.50.1, Release"); break; | |
| 2063 | case 29: | ||
| 2064 | ✗ | zprint2("Last saved in ZQuest Version: 2.50.2, Release"); break; | |
| 2065 | case 30: | ||
| 2066 | ✗ | zprint2("Last saved in ZQuest Version: 2.50.3, Gamma 1"); break; | |
| 2067 | case 31: | ||
| 2068 | ✗ | zprint2("Last saved in ZQuest Version: 2.53.0, Prior to Gamma 3"); break; | |
| 2069 | case 32: | ||
| 2070 | ✗ | zprint2("Last saved in ZQuest Version: 2.53.0"); break; | |
| 2071 | case 33: | ||
| 2072 | ✗ | zprint2("Last saved in ZQuest Version: 2.53.1"); break; | |
| 2073 | default: | ||
| 2074 | ✗ | zprint2("Last saved in ZQuest Version: %x, Build %d", tempheader.zelda_version,tempheader.build); break; | |
| 2075 | |||
| 2076 | } | ||
| 2077 | ✗ | break; | |
| 2078 | } | ||
| 2079 | |||
| 2080 | case 0x211: | ||
| 2081 | { | ||
| 2082 | ✗ | zprint2("Last saved in ZQuest Version: 2.11, Beta %d", tempheader.build); break; | |
| 2083 | } | ||
| 2084 | case 0x210: | ||
| 2085 | { | ||
| 2086 | ✗ | zprint2("Last saved in ZQuest Version: 2.10.x"); | |
| 2087 | ✗ | if ( tempheader.build ) zprint2("Beta/Build %d\n", tempheader.build); | |
| 2088 | ✗ | break; | |
| 2089 | } | ||
| 2090 | /* These versions cannot be handled here; they will be incorrect at this time. -Z | ||
| 2091 | case 0x193: | ||
| 2092 | { | ||
| 2093 | zprint2("Last saved in ZQuest Version: 1.93, Beta %d\n", tempheader.build); break; | ||
| 2094 | } | ||
| 2095 | case 0x192: | ||
| 2096 | { | ||
| 2097 | zprint2("Last saved in ZQuest Version: 1.92, Beta %d\n", tempheader.build); break; | ||
| 2098 | } | ||
| 2099 | case 0x190: | ||
| 2100 | { | ||
| 2101 | zprint2("Last saved in ZQuest Version: 1.90, Beta/Build %d\n", tempheader.build); break; | ||
| 2102 | } | ||
| 2103 | case 0x184: | ||
| 2104 | { | ||
| 2105 | zprint2("Last saved in ZQuest Version: 1.84, Beta/Build %d\n", tempheader.build); break; | ||
| 2106 | } | ||
| 2107 | case 0x183: | ||
| 2108 | { | ||
| 2109 | zprint2("Last saved in ZQuest Version: 1.83, Beta/Build %d\n", tempheader.build); break; | ||
| 2110 | } | ||
| 2111 | case 0x180: | ||
| 2112 | { | ||
| 2113 | zprint2("Last saved in ZQuest Version: 1.80, Beta/Build %d\n", tempheader.build); break; | ||
| 2114 | } | ||
| 2115 | default: | ||
| 2116 | { | ||
| 2117 | zprint2("Last saved in ZQuest Version: %x, Beta %d\n", tempheader.zelda_version,tempheader.build); break; | ||
| 2118 | } | ||
| 2119 | */ | ||
| 2120 | } | ||
| 2121 | } | ||
| 2122 |
3/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
|
74 | if(!tempheader.is_legacy() && tempheader.getAlphaVer()) |
| 2123 | 5 | zprint2("%s\n", tempheader.getAlphaVerStr()); | |
| 2124 | 69 | else zprint2("\n"); | |
| 2125 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 5 times.
|
74 | if ( tempheader.made_in_module_name[0] ) zprint2("Created with ZC Module: %s\n\n", tempheader.made_in_module_name); |
| 2126 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 5 times.
|
74 | if ( tempheader.new_version_devsig[0] ) zprint2("Developr Signoff by: %s\n", tempheader.new_version_devsig); |
| 2127 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 5 times.
|
74 | if ( tempheader.new_version_compilername[0] ) zprint2("Compiled with: %s, (ID: %d)\n", tempheader.new_version_compilername, tempheader.compilerid); |
| 2128 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 5 times.
|
74 | if ( tempheader.new_version_compilerversion[0] ) zprint2("Compiler Version: %s, (%d,%d,%d,%d)\n", tempheader.new_version_compilerversion,tempheader.compilerversionnumber_first,tempheader.compilerversionnumber_second,tempheader.compilerversionnumber_third,tempheader.compilerversionnumber_fourth); |
| 2129 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 74 times.
|
74 | if ( tempheader.product_name[0] ) zprint2("Project ID: %s\n", tempheader.product_name); |
| 2130 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 5 times.
|
74 | if ( tempheader.new_version_id_date_day ) zprint2("Editor Built at date and time: %d-%d-%d at @ %s %s\n", tempheader.new_version_id_date_day, tempheader.new_version_id_date_month, tempheader.new_version_id_date_year, tempheader.build_timestamp, tempheader.build_timezone); |
| 2131 | 74 | zprint2("\n"); | |
| 2132 | 74 | } | |
| 2133 | |||
| 2134 | 91 | int32_t readheader(PACKFILE *f, zquestheader *Header, bool keepdata, byte printmetadata) | |
| 2135 | { | ||
| 2136 | int32_t dummy; | ||
| 2137 | zquestheader tempheader; | ||
| 2138 | 91 | memcpy(&tempheader, Header, sizeof(tempheader)); | |
| 2139 | char dummybuf[80]; | ||
| 2140 | byte temp_map_count; | ||
| 2141 | byte temp_midi_flags[MIDIFLAGS_SIZE]; | ||
| 2142 | word version; | ||
| 2143 | char temp_pwd[30], temp_pwd2[30]; | ||
| 2144 | int16_t temp_pwdkey; | ||
| 2145 | cvs_MD5Context ctx; | ||
| 2146 | 91 | memset(temp_midi_flags, 0, MIDIFLAGS_SIZE); | |
| 2147 | 91 | memset(&tempheader, 0, sizeof(tempheader)); | |
| 2148 | 91 | memset(FFCore.quest_format, 0, sizeof(FFCore.quest_format)); | |
| 2149 | |||
| 2150 | |||
| 2151 | |||
| 2152 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 91 times.
|
91 | if(!pfread(tempheader.id_str,sizeof(tempheader.id_str),f,true)) // first read old header |
| 2153 | { | ||
| 2154 | ✗ | Z_message("Unable to read header string\n"); | |
| 2155 | ✗ | return qe_invalid; | |
| 2156 | } | ||
| 2157 | |||
| 2158 | // check header | ||
| 2159 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(strcmp(tempheader.id_str,QH_NEWIDSTR)) |
| 2160 | { | ||
| 2161 | ✗ | if(strcmp(tempheader.id_str,QH_IDSTR)) | |
| 2162 | { | ||
| 2163 | ✗ | Z_message("Invalid header string: '%s' (was expecting '%s' or '%s')\n", tempheader.id_str, QH_IDSTR, QH_NEWIDSTR); | |
| 2164 | ✗ | return qe_invalid; | |
| 2165 | } | ||
| 2166 | } | ||
| 2167 | |||
| 2168 | 91 | int32_t templatepath_len=0; | |
| 2169 | |||
| 2170 | 91 | tempheader.external_zinfo = false; | |
| 2171 | 91 | read_zinfo = false; | |
| 2172 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!strcmp(tempheader.id_str,QH_IDSTR)) //pre-1.93 version |
| 2173 | { | ||
| 2174 | byte padding; | ||
| 2175 | |||
| 2176 | ✗ | if(!p_getc(&padding,f,true)) | |
| 2177 | { | ||
| 2178 | ✗ | return qe_invalid; | |
| 2179 | } | ||
| 2180 | |||
| 2181 | ✗ | if(!p_igetw(&tempheader.zelda_version,f,true)) | |
| 2182 | { | ||
| 2183 | ✗ | return qe_invalid; | |
| 2184 | } | ||
| 2185 | |||
| 2186 | ✗ | FFCore.quest_format[vZelda] = tempheader.zelda_version; | |
| 2187 | |||
| 2188 | ✗ | if(tempheader.zelda_version > ZELDA_VERSION) | |
| 2189 | { | ||
| 2190 | ✗ | return qe_version; | |
| 2191 | } | ||
| 2192 | |||
| 2193 | ✗ | FFCore.quest_format[vZelda] = tempheader.zelda_version; | |
| 2194 | |||
| 2195 | ✗ | if(strcmp(tempheader.id_str,QH_IDSTR)) | |
| 2196 | { | ||
| 2197 | ✗ | return qe_invalid; | |
| 2198 | } | ||
| 2199 | |||
| 2200 | ✗ | if(bad_version(tempheader.zelda_version)) | |
| 2201 | { | ||
| 2202 | ✗ | return qe_obsolete; | |
| 2203 | } | ||
| 2204 | |||
| 2205 | ✗ | if(!p_igetw(&tempheader.internal,f,true)) | |
| 2206 | { | ||
| 2207 | ✗ | return qe_invalid; | |
| 2208 | } | ||
| 2209 | |||
| 2210 | ✗ | if(!p_getc(&tempheader.quest_number,f,true)) | |
| 2211 | { | ||
| 2212 | ✗ | return qe_invalid; | |
| 2213 | } | ||
| 2214 | |||
| 2215 | ✗ | FFCore.quest_format[qQuestNumber] = tempheader.quest_number; | |
| 2216 | |||
| 2217 | ✗ | if(!pfread(&quest_rules[0],2,f,true)) | |
| 2218 | { | ||
| 2219 | ✗ | return qe_invalid; | |
| 2220 | } | ||
| 2221 | |||
| 2222 | ✗ | if(!p_getc(&temp_map_count,f,true)) | |
| 2223 | { | ||
| 2224 | ✗ | return qe_invalid; | |
| 2225 | } | ||
| 2226 | |||
| 2227 | ✗ | FFCore.quest_format[qMapCount] = temp_map_count; | |
| 2228 | |||
| 2229 | ✗ | if(!p_getc(&tempheader.old_str_count,f,true)) | |
| 2230 | { | ||
| 2231 | ✗ | return qe_invalid; | |
| 2232 | } | ||
| 2233 | |||
| 2234 | ✗ | if(!p_getc(&tempheader.data_flags[ZQ_TILES],f,true)) | |
| 2235 | { | ||
| 2236 | ✗ | return qe_invalid; | |
| 2237 | } | ||
| 2238 | |||
| 2239 | ✗ | if(!pfread(temp_midi_flags,4,f,true)) | |
| 2240 | { | ||
| 2241 | ✗ | return qe_invalid; | |
| 2242 | } | ||
| 2243 | |||
| 2244 | ✗ | if(!p_getc(&tempheader.data_flags[ZQ_CHEATS2],f,true)) | |
| 2245 | { | ||
| 2246 | ✗ | return qe_invalid; | |
| 2247 | } | ||
| 2248 | |||
| 2249 | ✗ | if(!pfread(dummybuf,14,f,true)) | |
| 2250 | { | ||
| 2251 | ✗ | return qe_invalid; | |
| 2252 | } | ||
| 2253 | |||
| 2254 | ✗ | if(!pfread(&quest_rules[2],2,f,true)) | |
| 2255 | { | ||
| 2256 | ✗ | return qe_invalid; | |
| 2257 | } | ||
| 2258 | |||
| 2259 | ✗ | if(!p_getc(&dummybuf,f,true)) | |
| 2260 | { | ||
| 2261 | ✗ | return qe_invalid; | |
| 2262 | } | ||
| 2263 | |||
| 2264 | ✗ | if(!pfread(tempheader.version,sizeof(tempheader.version),f,true)) | |
| 2265 | { | ||
| 2266 | ✗ | return qe_invalid; | |
| 2267 | } | ||
| 2268 | |||
| 2269 | ✗ | if(!pfread(tempheader.title,sizeof(tempheader.title),f,true)) | |
| 2270 | { | ||
| 2271 | ✗ | return qe_invalid; | |
| 2272 | } | ||
| 2273 | // These fields are expected to end in null bytes! | ||
| 2274 | ✗ | tempheader.title[sizeof(tempheader.title)-1] = 0; | |
| 2275 | |||
| 2276 | ✗ | if(!pfread(tempheader.author,sizeof(tempheader.author),f,true)) | |
| 2277 | { | ||
| 2278 | ✗ | return qe_invalid; | |
| 2279 | } | ||
| 2280 | ✗ | tempheader.author[sizeof(tempheader.author)-1] = 0; | |
| 2281 | |||
| 2282 | ✗ | if(!p_getc(&padding,f,true)) | |
| 2283 | { | ||
| 2284 | ✗ | return qe_invalid; | |
| 2285 | } | ||
| 2286 | |||
| 2287 | ✗ | if(!p_igetw(&temp_pwdkey,f,true)) | |
| 2288 | { | ||
| 2289 | ✗ | return qe_invalid; | |
| 2290 | } | ||
| 2291 | |||
| 2292 | ✗ | if(!pfread(temp_pwd,30,f,true)) | |
| 2293 | { | ||
| 2294 | ✗ | return qe_invalid; | |
| 2295 | } | ||
| 2296 | |||
| 2297 | ✗ | get_questpwd(temp_pwd, temp_pwdkey, temp_pwd2); | |
| 2298 | ✗ | cvs_MD5Init(&ctx); | |
| 2299 | ✗ | cvs_MD5Update(&ctx, (const uint8_t*)temp_pwd2, (unsigned)strlen(temp_pwd2)); | |
| 2300 | ✗ | cvs_MD5Final(tempheader.pwd_hash, &ctx); | |
| 2301 | |||
| 2302 | ✗ | if(tempheader.zelda_version < 0x177) // lacks new header stuff... | |
| 2303 | { | ||
| 2304 | //memset(tempheader.minver,0,20); // char minver[9], byte build, byte foo[10] | ||
| 2305 | // Not anymore... | ||
| 2306 | ✗ | memset(tempheader.minver,0,9); | |
| 2307 | ✗ | tempheader.build=0; | |
| 2308 | ✗ | tempheader.use_keyfile=0; | |
| 2309 | ✗ | memset(tempheader.old_foo, 0, 9); | |
| 2310 | } | ||
| 2311 | else | ||
| 2312 | { | ||
| 2313 | ✗ | if(!pfread(tempheader.minver,sizeof(tempheader.minver),f,true)) | |
| 2314 | { | ||
| 2315 | ✗ | return qe_invalid; | |
| 2316 | } | ||
| 2317 | |||
| 2318 | ✗ | if(!p_getc(&tempheader.build,f,true)) | |
| 2319 | { | ||
| 2320 | ✗ | return qe_invalid; | |
| 2321 | } | ||
| 2322 | |||
| 2323 | ✗ | FFCore.quest_format[vBuild] = tempheader.build; | |
| 2324 | |||
| 2325 | ✗ | if(!p_getc(&tempheader.use_keyfile,f,true)) | |
| 2326 | { | ||
| 2327 | ✗ | return qe_invalid; | |
| 2328 | } | ||
| 2329 | |||
| 2330 | ✗ | if(!pfread(dummybuf,9,f,true)) | |
| 2331 | { | ||
| 2332 | ✗ | return qe_invalid; | |
| 2333 | } | ||
| 2334 | } // starting at minver | ||
| 2335 | |||
| 2336 | ✗ | if(tempheader.zelda_version < 0x187) // lacks newer header stuff... | |
| 2337 | { | ||
| 2338 | ✗ | memset(&quest_rules[4],0,16); // word rules3..rules10 | |
| 2339 | } | ||
| 2340 | else | ||
| 2341 | { | ||
| 2342 | ✗ | if(!pfread(&quest_rules[4],16,f,true)) // read new header additions | |
| 2343 | { | ||
| 2344 | ✗ | return qe_invalid; // starting at rules3 | |
| 2345 | } | ||
| 2346 | |||
| 2347 | ✗ | if(tempheader.zelda_version <= 0x190) | |
| 2348 | { | ||
| 2349 | ✗ | set_bit(quest_rules,qr_MEANPLACEDTRAPS,0); | |
| 2350 | } | ||
| 2351 | } | ||
| 2352 | |||
| 2353 | ✗ | if((tempheader.zelda_version < 0x192)|| | |
| 2354 | ✗ | ((tempheader.zelda_version == 0x192)&&(tempheader.build<149))) | |
| 2355 | { | ||
| 2356 | ✗ | set_bit(quest_rules,qr_BRKNSHLDTILES,(get_bit(quest_rules,qr_BRKBLSHLDS_DEP))); | |
| 2357 | ✗ | set_bit(deprecated_rules,qr_BRKBLSHLDS_DEP,1); | |
| 2358 | } | ||
| 2359 | |||
| 2360 | ✗ | if(tempheader.zelda_version >= 0x192) // lacks newer header stuff... | |
| 2361 | { | ||
| 2362 | ✗ | byte *mf=temp_midi_flags; | |
| 2363 | |||
| 2364 | ✗ | if((tempheader.zelda_version == 0x192)&&(tempheader.build<178)) | |
| 2365 | { | ||
| 2366 | ✗ | mf=(byte*)dummybuf; | |
| 2367 | } | ||
| 2368 | |||
| 2369 | ✗ | if(!pfread(mf,32,f,true)) // read new header additions | |
| 2370 | { | ||
| 2371 | ✗ | return qe_invalid; // starting at foo2 | |
| 2372 | } | ||
| 2373 | |||
| 2374 | ✗ | if(!pfread(dummybuf,18,f,true)) // read new header additions | |
| 2375 | { | ||
| 2376 | ✗ | return qe_invalid; // starting at foo2 | |
| 2377 | } | ||
| 2378 | } | ||
| 2379 | |||
| 2380 | ✗ | if((tempheader.zelda_version < 0x192)|| | |
| 2381 | ✗ | ((tempheader.zelda_version == 0x192)&&(tempheader.build<145))) | |
| 2382 | { | ||
| 2383 | ✗ | memset(tempheader.templatepath,0,2048); | |
| 2384 | } | ||
| 2385 | else | ||
| 2386 | { | ||
| 2387 | ✗ | if(!pfread(tempheader.templatepath,280,f,true)) // read templatepath | |
| 2388 | { | ||
| 2389 | ✗ | return qe_invalid; | |
| 2390 | } | ||
| 2391 | } | ||
| 2392 | |||
| 2393 | ✗ | if((tempheader.zelda_version < 0x192)|| | |
| 2394 | ✗ | ((tempheader.zelda_version == 0x192)&&(tempheader.build<186))) | |
| 2395 | { | ||
| 2396 | ✗ | tempheader.use_keyfile=0; | |
| 2397 | } | ||
| 2398 | } | ||
| 2399 | else | ||
| 2400 | { | ||
| 2401 | //section id | ||
| 2402 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 91 times.
|
91 | if(!p_mgetl(&dummy,f,true)) |
| 2403 | { | ||
| 2404 | ✗ | return qe_invalid; | |
| 2405 | } | ||
| 2406 | |||
| 2407 | //section version info | ||
| 2408 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!p_igetw(&version,f,true)) |
| 2409 | { | ||
| 2410 | ✗ | return qe_invalid; | |
| 2411 | } | ||
| 2412 | |||
| 2413 | 91 | FFCore.quest_format[vHeader] = version; | |
| 2414 | |||
| 2415 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!p_igetw(&dummy,f,true)) |
| 2416 | { | ||
| 2417 | ✗ | return qe_invalid; | |
| 2418 | } | ||
| 2419 | |||
| 2420 | //section size | ||
| 2421 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!p_igetl(&dummy,f,true)) |
| 2422 | { | ||
| 2423 | ✗ | return qe_invalid; | |
| 2424 | } | ||
| 2425 | |||
| 2426 | //finally... section data | ||
| 2427 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!p_igetw(&tempheader.zelda_version,f,true)) |
| 2428 | { | ||
| 2429 | ✗ | return qe_invalid; | |
| 2430 | } | ||
| 2431 | |||
| 2432 | 91 | FFCore.quest_format[vZelda] = tempheader.zelda_version; | |
| 2433 | |||
| 2434 | //do some quick checking... | ||
| 2435 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 91 times.
|
91 | if(tempheader.zelda_version > ZELDA_VERSION) |
| 2436 | { | ||
| 2437 | ✗ | return qe_version; | |
| 2438 | } | ||
| 2439 | |||
| 2440 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 91 times.
|
91 | if(strcmp(tempheader.id_str,QH_NEWIDSTR)) |
| 2441 | { | ||
| 2442 | ✗ | return qe_invalid; | |
| 2443 | } | ||
| 2444 | |||
| 2445 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 91 times.
|
91 | if(bad_version(tempheader.zelda_version)) |
| 2446 | { | ||
| 2447 | ✗ | return qe_obsolete; | |
| 2448 | } | ||
| 2449 | |||
| 2450 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!p_getc(&tempheader.build,f,true)) |
| 2451 | { | ||
| 2452 | ✗ | return qe_invalid; | |
| 2453 | } | ||
| 2454 | |||
| 2455 | 91 | FFCore.quest_format[vBuild] = tempheader.build; | |
| 2456 | |||
| 2457 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 91 times.
|
91 | if(version<3) |
| 2458 | { | ||
| 2459 | ✗ | if(!pfread(temp_pwd,30,f,true)) | |
| 2460 | { | ||
| 2461 | ✗ | return qe_invalid; | |
| 2462 | } | ||
| 2463 | |||
| 2464 | ✗ | if(!p_igetw(&temp_pwdkey,f,true)) | |
| 2465 | { | ||
| 2466 | ✗ | return qe_invalid; | |
| 2467 | } | ||
| 2468 | |||
| 2469 | ✗ | get_questpwd(temp_pwd, temp_pwdkey, temp_pwd2); | |
| 2470 | ✗ | cvs_MD5Init(&ctx); | |
| 2471 | ✗ | cvs_MD5Update(&ctx, (const uint8_t*)temp_pwd2, (unsigned)strlen(temp_pwd2)); | |
| 2472 | ✗ | cvs_MD5Final(tempheader.pwd_hash, &ctx); | |
| 2473 | } | ||
| 2474 | else | ||
| 2475 | { | ||
| 2476 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!pfread(tempheader.pwd_hash,sizeof(tempheader.pwd_hash),f,true)) |
| 2477 | { | ||
| 2478 | ✗ | return qe_invalid; | |
| 2479 | } | ||
| 2480 | } | ||
| 2481 | |||
| 2482 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!p_igetw(&tempheader.internal,f,true)) |
| 2483 | { | ||
| 2484 | ✗ | return qe_invalid; | |
| 2485 | } | ||
| 2486 | |||
| 2487 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!p_getc(&tempheader.quest_number,f,true)) |
| 2488 | { | ||
| 2489 | ✗ | return qe_invalid; | |
| 2490 | } | ||
| 2491 | |||
| 2492 | 91 | FFCore.quest_format[qQuestNumber] = tempheader.quest_number; | |
| 2493 | |||
| 2494 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!pfread(tempheader.version,sizeof(tempheader.version),f,true)) |
| 2495 | { | ||
| 2496 | ✗ | return qe_invalid; | |
| 2497 | } | ||
| 2498 | |||
| 2499 | //FFCore.quest_format[qQuestVersion] = tempheader.version; | ||
| 2500 | //needs to be copied as char[9] or stored as a s.str | ||
| 2501 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!pfread(tempheader.minver,sizeof(tempheader.minver),f,true)) |
| 2502 | { | ||
| 2503 | ✗ | return qe_invalid; | |
| 2504 | } | ||
| 2505 | |||
| 2506 | //FFCore.quest_format[qMinQuestVersion] = tempheader.minver; | ||
| 2507 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!pfread(tempheader.title,sizeof(tempheader.title),f,true)) |
| 2508 | { | ||
| 2509 | ✗ | return qe_invalid; | |
| 2510 | } | ||
| 2511 | 91 | tempheader.title[sizeof(tempheader.title)-1] = 0; | |
| 2512 | |||
| 2513 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!pfread(tempheader.author,sizeof(tempheader.author),f,true)) |
| 2514 | { | ||
| 2515 | ✗ | return qe_invalid; | |
| 2516 | } | ||
| 2517 | 91 | tempheader.author[sizeof(tempheader.author)-1] = 0; | |
| 2518 | |||
| 2519 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!p_getc(&tempheader.use_keyfile,f,true)) |
| 2520 | { | ||
| 2521 | ✗ | return qe_invalid; | |
| 2522 | } | ||
| 2523 | |||
| 2524 | /* | ||
| 2525 | if(!pfread(tempheader.data_flags,sizeof(tempheader.data_flags),f,true)) | ||
| 2526 | { | ||
| 2527 | return qe_invalid; | ||
| 2528 | } | ||
| 2529 | */ | ||
| 2530 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!p_getc(&tempheader.data_flags[ZQ_TILES],f,true)) |
| 2531 | { | ||
| 2532 | ✗ | return qe_invalid; | |
| 2533 | } | ||
| 2534 | |||
| 2535 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!pfread(&dummybuf,4,f,true)) |
| 2536 | { | ||
| 2537 | ✗ | return qe_invalid; | |
| 2538 | } | ||
| 2539 | |||
| 2540 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!p_getc(&tempheader.data_flags[ZQ_CHEATS2],f,true)) |
| 2541 | { | ||
| 2542 | ✗ | return qe_invalid; | |
| 2543 | } | ||
| 2544 | |||
| 2545 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!pfread(dummybuf,14,f,true)) |
| 2546 | { | ||
| 2547 | ✗ | return qe_invalid; | |
| 2548 | } | ||
| 2549 | |||
| 2550 | 91 | templatepath_len=sizeof(tempheader.templatepath); | |
| 2551 | |||
| 2552 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(version==1) |
| 2553 | { | ||
| 2554 | ✗ | templatepath_len=280; | |
| 2555 | } | ||
| 2556 | |||
| 2557 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!pfread(tempheader.templatepath,templatepath_len,f,true)) |
| 2558 | { | ||
| 2559 | ✗ | return qe_invalid; | |
| 2560 | } | ||
| 2561 | |||
| 2562 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | if(!p_getc(&temp_map_count,f,true)) |
| 2563 | { | ||
| 2564 | ✗ | return qe_invalid; | |
| 2565 | } | ||
| 2566 | |||
| 2567 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 69 times.
|
91 | if(version>=4) |
| 2568 | { | ||
| 2569 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_igetl(&tempheader.new_version_id_main,f,true)) |
| 2570 | { | ||
| 2571 | ✗ | return qe_invalid; | |
| 2572 | } | ||
| 2573 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_igetl(&tempheader.new_version_id_second,f,true)) |
| 2574 | { | ||
| 2575 | ✗ | return qe_invalid; | |
| 2576 | } | ||
| 2577 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_igetl(&tempheader.new_version_id_third,f,true)) |
| 2578 | { | ||
| 2579 | ✗ | return qe_invalid; | |
| 2580 | } | ||
| 2581 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_igetl(&tempheader.new_version_id_fourth,f,true)) |
| 2582 | { | ||
| 2583 | ✗ | return qe_invalid; | |
| 2584 | } | ||
| 2585 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_igetl(&tempheader.new_version_id_alpha,f,true)) |
| 2586 | { | ||
| 2587 | ✗ | return qe_invalid; | |
| 2588 | } | ||
| 2589 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_igetl(&tempheader.new_version_id_beta,f,true)) |
| 2590 | { | ||
| 2591 | ✗ | return qe_invalid; | |
| 2592 | } | ||
| 2593 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_igetl(&tempheader.new_version_id_gamma,f,true)) |
| 2594 | { | ||
| 2595 | ✗ | return qe_invalid; | |
| 2596 | } | ||
| 2597 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_igetl(&tempheader.new_version_id_release,f,true)) |
| 2598 | { | ||
| 2599 | ✗ | return qe_invalid; | |
| 2600 | } | ||
| 2601 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_igetw(&tempheader.new_version_id_date_year,f,true)) |
| 2602 | { | ||
| 2603 | ✗ | return qe_invalid; | |
| 2604 | } | ||
| 2605 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_getc(&tempheader.new_version_id_date_month,f,true)) |
| 2606 | { | ||
| 2607 | ✗ | return qe_invalid; | |
| 2608 | } | ||
| 2609 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_getc(&tempheader.new_version_id_date_day,f,true)) |
| 2610 | { | ||
| 2611 | ✗ | return qe_invalid; | |
| 2612 | } | ||
| 2613 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_getc(&tempheader.new_version_id_date_hour,f,true)) |
| 2614 | { | ||
| 2615 | ✗ | return qe_invalid; | |
| 2616 | } | ||
| 2617 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_getc(&tempheader.new_version_id_date_minute,f,true)) |
| 2618 | { | ||
| 2619 | ✗ | return qe_invalid; | |
| 2620 | } | ||
| 2621 | |||
| 2622 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!pfread(tempheader.new_version_devsig,256,f,true)) |
| 2623 | { | ||
| 2624 | ✗ | return qe_invalid; | |
| 2625 | } | ||
| 2626 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22 times.
|
22 | if(!strcmp(tempheader.new_version_devsig, "Venrob")) |
| 2627 | ✗ | strcpy(tempheader.new_version_devsig, "EmilyV99"); | |
| 2628 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!pfread(tempheader.new_version_compilername,256,f,true)) |
| 2629 | { | ||
| 2630 | ✗ | return qe_invalid; | |
| 2631 | } | ||
| 2632 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!pfread(tempheader.new_version_compilerversion,256,f,true)) |
| 2633 | { | ||
| 2634 | ✗ | return qe_invalid; | |
| 2635 | } | ||
| 2636 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!pfread(tempheader.product_name,1024,f,true)) |
| 2637 | { | ||
| 2638 | ✗ | return qe_invalid; | |
| 2639 | } | ||
| 2640 | |||
| 2641 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_getc(&tempheader.compilerid,f,true)) |
| 2642 | { | ||
| 2643 | ✗ | return qe_invalid; | |
| 2644 | } | ||
| 2645 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_igetl(&tempheader.compilerversionnumber_first,f,true)) |
| 2646 | { | ||
| 2647 | ✗ | return qe_invalid; | |
| 2648 | } | ||
| 2649 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_igetl(&tempheader.compilerversionnumber_second,f,true)) |
| 2650 | { | ||
| 2651 | ✗ | return qe_invalid; | |
| 2652 | } | ||
| 2653 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_igetl(&tempheader.compilerversionnumber_third,f,true)) |
| 2654 | { | ||
| 2655 | ✗ | return qe_invalid; | |
| 2656 | } | ||
| 2657 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_igetl(&tempheader.compilerversionnumber_fourth,f,true)) |
| 2658 | { | ||
| 2659 | ✗ | return qe_invalid; | |
| 2660 | } | ||
| 2661 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_igetw(&tempheader.developerid,f,true)) |
| 2662 | { | ||
| 2663 | ✗ | return qe_invalid; | |
| 2664 | } | ||
| 2665 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!pfread(tempheader.made_in_module_name,1024,f,true)) |
| 2666 | { | ||
| 2667 | ✗ | return qe_invalid; | |
| 2668 | } | ||
| 2669 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!pfread(tempheader.build_datestamp,256,f,true)) |
| 2670 | { | ||
| 2671 | ✗ | return qe_invalid; | |
| 2672 | } | ||
| 2673 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22 times.
|
22 | if(!pfread(tempheader.build_timestamp,256,f,true)) |
| 2674 | { | ||
| 2675 | ✗ | return qe_invalid; | |
| 2676 | } | ||
| 2677 | 22 | } | |
| 2678 | else // <4 | ||
| 2679 | { | ||
| 2680 | 69 | tempheader.new_version_id_main = 0; | |
| 2681 | 69 | tempheader.new_version_id_second = 0; | |
| 2682 | 69 | tempheader.new_version_id_third = 0; | |
| 2683 | 69 | tempheader.new_version_id_fourth = 0; | |
| 2684 | 69 | tempheader.new_version_id_alpha = 0; | |
| 2685 | 69 | tempheader.new_version_id_beta = 0; | |
| 2686 | 69 | tempheader.new_version_id_gamma = 0; | |
| 2687 | 69 | tempheader.new_version_id_release = 0; | |
| 2688 | 69 | tempheader.new_version_id_date_year = 0; | |
| 2689 | 69 | tempheader.new_version_id_date_month = 0; | |
| 2690 | 69 | tempheader.new_version_id_date_day = 0; | |
| 2691 | 69 | tempheader.new_version_id_date_hour = 0; | |
| 2692 | 69 | tempheader.new_version_id_date_minute = 0; | |
| 2693 | |||
| 2694 | 69 | memset(tempheader.new_version_devsig, 0, 256); | |
| 2695 | 69 | memset(tempheader.new_version_compilername, 0, 256); | |
| 2696 | 69 | memset(tempheader.new_version_compilerversion, 0, 256); | |
| 2697 | 69 | memset(tempheader.product_name, 0, 1024); | |
| 2698 | 69 | strcpy(tempheader.product_name, "ZQuest Creator Suite"); | |
| 2699 | |||
| 2700 | 69 | tempheader.compilerid = 0; | |
| 2701 | 69 | tempheader.compilerversionnumber_first = 0; | |
| 2702 | 69 | tempheader.compilerversionnumber_second = 0; | |
| 2703 | 69 | tempheader.compilerversionnumber_third = 0; | |
| 2704 | 69 | tempheader.compilerversionnumber_fourth = 0; | |
| 2705 | 69 | tempheader.developerid = 0; | |
| 2706 | |||
| 2707 | 69 | memset(tempheader.made_in_module_name, 0, 1024); | |
| 2708 | 69 | memset(tempheader.build_datestamp, 0, 256); | |
| 2709 | 69 | memset(tempheader.build_timestamp, 0, 256); | |
| 2710 | } | ||
| 2711 | |||
| 2712 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 69 times.
|
91 | if ( version >= 5 ) |
| 2713 | { | ||
| 2714 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!pfread(tempheader.build_timezone,6,f,true)) |
| 2715 | { | ||
| 2716 | ✗ | return qe_invalid; | |
| 2717 | } | ||
| 2718 | 22 | } | |
| 2719 | else // < 5 | ||
| 2720 | { | ||
| 2721 | 69 | memset(tempheader.build_timezone, 0, 6); | |
| 2722 | } | ||
| 2723 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 22 times.
|
91 | if ( version >= 6 ) |
| 2724 | { | ||
| 2725 | byte b; | ||
| 2726 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_getc(&b,f,true)) |
| 2727 | { | ||
| 2728 | ✗ | return qe_invalid; | |
| 2729 | } | ||
| 2730 | 22 | tempheader.external_zinfo = b?true:false; | |
| 2731 | 22 | read_zinfo = true; | |
| 2732 | 22 | } | |
| 2733 | |||
| 2734 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 69 times.
|
91 | if(version >= 7) |
| 2735 | { | ||
| 2736 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(!p_getc(&(tempheader.new_version_is_nightly),f,true)) |
| 2737 | { | ||
| 2738 | ✗ | return qe_invalid; | |
| 2739 | } | ||
| 2740 | 22 | } | |
| 2741 | else | ||
| 2742 | { | ||
| 2743 | 69 | tempheader.new_version_is_nightly = false; | |
| 2744 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if(tempheader.zelda_version < 0x255) |
| 2745 | { | ||
| 2746 |
1/5✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
69 | switch(tempheader.zelda_version) |
| 2747 | { | ||
| 2748 | case 0x254: | ||
| 2749 | ✗ | tempheader.new_version_id_main = 2; | |
| 2750 | ✗ | tempheader.new_version_id_second = 54; | |
| 2751 | ✗ | break; | |
| 2752 | case 0x250: | ||
| 2753 |
5/16✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 18 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 5 times.
✓ Branch 11 taken 23 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 15 times.
✓ Branch 14 taken 8 times.
✗ Branch 15 not taken.
|
69 | switch(tempheader.build) |
| 2754 | { | ||
| 2755 | case 19: | ||
| 2756 | ✗ | tempheader.new_version_id_main = 2; | |
| 2757 | ✗ | tempheader.new_version_id_second = 50; | |
| 2758 | ✗ | tempheader.new_version_id_gamma = 1; | |
| 2759 | ✗ | break; | |
| 2760 | case 20: | ||
| 2761 | ✗ | tempheader.new_version_id_main = 2; | |
| 2762 | ✗ | tempheader.new_version_id_second = 50; | |
| 2763 | ✗ | tempheader.new_version_id_gamma = 2; | |
| 2764 | ✗ | break; | |
| 2765 | case 21: | ||
| 2766 | ✗ | tempheader.new_version_id_main = 2; | |
| 2767 | ✗ | tempheader.new_version_id_second = 50; | |
| 2768 | ✗ | tempheader.new_version_id_gamma = 3; | |
| 2769 | ✗ | break; | |
| 2770 | case 22: | ||
| 2771 | ✗ | tempheader.new_version_id_main = 2; | |
| 2772 | ✗ | tempheader.new_version_id_second = 50; | |
| 2773 | ✗ | tempheader.new_version_id_gamma = 4; | |
| 2774 | ✗ | break; | |
| 2775 | case 23: | ||
| 2776 | ✗ | tempheader.new_version_id_main = 2; | |
| 2777 | ✗ | tempheader.new_version_id_second = 50; | |
| 2778 | ✗ | tempheader.new_version_id_gamma = 5; | |
| 2779 | ✗ | break; | |
| 2780 | case 24: | ||
| 2781 | 18 | tempheader.new_version_id_main = 2; | |
| 2782 | 18 | tempheader.new_version_id_second = 50; | |
| 2783 | 18 | tempheader.new_version_id_release = -1; | |
| 2784 | 18 | break; | |
| 2785 | case 25: | ||
| 2786 | ✗ | tempheader.new_version_id_main = 2; | |
| 2787 | ✗ | tempheader.new_version_id_second = 50; | |
| 2788 | ✗ | tempheader.new_version_id_third = 1; | |
| 2789 | ✗ | tempheader.new_version_id_gamma = 1; | |
| 2790 | ✗ | break; | |
| 2791 | case 26: | ||
| 2792 | ✗ | tempheader.new_version_id_main = 2; | |
| 2793 | ✗ | tempheader.new_version_id_second = 50; | |
| 2794 | ✗ | tempheader.new_version_id_third = 1; | |
| 2795 | ✗ | tempheader.new_version_id_gamma = 2; | |
| 2796 | ✗ | break; | |
| 2797 | case 27: | ||
| 2798 | ✗ | tempheader.new_version_id_main = 2; | |
| 2799 | ✗ | tempheader.new_version_id_second = 50; | |
| 2800 | ✗ | tempheader.new_version_id_third = 1; | |
| 2801 | ✗ | tempheader.new_version_id_gamma = 3; | |
| 2802 | ✗ | break; | |
| 2803 | case 28: | ||
| 2804 | 5 | tempheader.new_version_id_main = 2; | |
| 2805 | 5 | tempheader.new_version_id_second = 50; | |
| 2806 | 5 | tempheader.new_version_id_third = 1; | |
| 2807 | 5 | tempheader.new_version_id_release = -1; | |
| 2808 | 5 | break; | |
| 2809 | case 29: | ||
| 2810 | 23 | tempheader.new_version_id_main = 2; | |
| 2811 | 23 | tempheader.new_version_id_second = 50; | |
| 2812 | 23 | tempheader.new_version_id_third = 2; | |
| 2813 | 23 | tempheader.new_version_id_release = -1; | |
| 2814 | 23 | break; | |
| 2815 | case 30: | ||
| 2816 | ✗ | tempheader.new_version_id_main = 2; | |
| 2817 | ✗ | tempheader.new_version_id_second = 50; | |
| 2818 | ✗ | tempheader.new_version_id_third = 3; | |
| 2819 | ✗ | tempheader.new_version_id_gamma = 1; | |
| 2820 | ✗ | break; | |
| 2821 | case 31: | ||
| 2822 | 15 | tempheader.new_version_id_main = 2; | |
| 2823 | 15 | tempheader.new_version_id_second = 53; | |
| 2824 | 15 | tempheader.new_version_id_gamma = -1; | |
| 2825 | 15 | break; | |
| 2826 | case 32: | ||
| 2827 | 8 | tempheader.new_version_id_main = 2; | |
| 2828 | 8 | tempheader.new_version_id_second = 53; | |
| 2829 | 8 | tempheader.new_version_id_release = -1; | |
| 2830 | 8 | break; | |
| 2831 | case 33: | ||
| 2832 | ✗ | tempheader.new_version_id_main = 2; | |
| 2833 | ✗ | tempheader.new_version_id_second = 53; | |
| 2834 | ✗ | tempheader.new_version_id_third = 1; | |
| 2835 | ✗ | break; | |
| 2836 | } | ||
| 2837 | 69 | break; | |
| 2838 | |||
| 2839 | case 0x211: | ||
| 2840 | ✗ | tempheader.new_version_id_main = 2; | |
| 2841 | ✗ | tempheader.new_version_id_second = 11; | |
| 2842 | ✗ | tempheader.new_version_id_beta = tempheader.build; | |
| 2843 | ✗ | break; | |
| 2844 | case 0x210: | ||
| 2845 | ✗ | tempheader.new_version_id_main = 2; | |
| 2846 | ✗ | tempheader.new_version_id_second = 10; | |
| 2847 | ✗ | tempheader.new_version_id_beta = tempheader.build; | |
| 2848 | ✗ | break; | |
| 2849 | } | ||
| 2850 | 69 | } | |
| 2851 | } | ||
| 2852 |
2/4✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 91 times.
|
91 | if(printmetadata || __isZQuest) |
| 2853 | { | ||
| 2854 | ✗ | print_quest_metadata(tempheader, loading_qst_name, loading_qst_num); | |
| 2855 | } | ||
| 2856 | } | ||
| 2857 | |||
| 2858 | //{ Version Warning | ||
| 2859 | 91 | int32_t vercmp = tempheader.compareVer(); | |
| 2860 | 91 | int32_t astatecmp = compare(int32_t(tempheader.getAlphaState()), ALPHA_STATE); | |
| 2861 | 91 | int32_t avercmp = compare(tempheader.getAlphaVer(), ALPHA_VER); | |
| 2862 |
4/6✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
✓ Branch 3 taken 69 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 22 times.
|
113 | if(vercmp > 0 || (!vercmp && |
| 2863 |
2/4✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
✗ Branch 3 not taken.
|
22 | (astatecmp > 0 || (!astatecmp && |
| 2864 | 22 | avercmp > 0)))) | |
| 2865 | { | ||
| 2866 | ✗ | bool r = true; | |
| 2867 | ✗ | if(loadquest_report) | |
| 2868 | { | ||
| 2869 | ✗ | enter_sys_pal(); | |
| 2870 | ✗ | AlertDialog("Quest saved in newer version", | |
| 2871 | "This quest was last saved in a newer version of ZQuest." | ||
| 2872 | " Attempting to load this quest may not work correctly; to" | ||
| 2873 | ✗ | " avoid issues, try loading this quest in at least '" + std::string(tempheader.getVerStr()) + "'" | |
| 2874 | "\n\nWould you like to continue loading anyway? (Not recommended)", | ||
| 2875 | ✗ | [&](bool ret,bool) | |
| 2876 | { | ||
| 2877 | ✗ | r = ret; | |
| 2878 | ✗ | }).show(); | |
| 2879 | ✗ | exit_sys_pal(); | |
| 2880 | } | ||
| 2881 | ✗ | if(!r) | |
| 2882 | ✗ | return qe_silenterr; | |
| 2883 | } | ||
| 2884 |
1/2✓ Branch 0 taken 91 times.
✗ Branch 1 not taken.
|
91 | else if(tempheader.compareDate() > 0) |
| 2885 | { | ||
| 2886 | ✗ | bool r = true; | |
| 2887 | ✗ | if(loadquest_report) | |
| 2888 | { | ||
| 2889 | ✗ | enter_sys_pal(); | |
| 2890 | ✗ | AlertDialog("Quest saved in newer build", | |
| 2891 | ✗ | "This quest was last saved in a newer build of ZQuest, and may have" | |
| 2892 | " issues loading in this build." | ||
| 2893 | "\n\nWould you like to continue loading anyway?", | ||
| 2894 | ✗ | [&](bool ret,bool) | |
| 2895 | { | ||
| 2896 | ✗ | r = ret; | |
| 2897 | ✗ | }).show(); | |
| 2898 | ✗ | exit_sys_pal(); | |
| 2899 | } | ||
| 2900 | ✗ | if(!r) | |
| 2901 | ✗ | return qe_silenterr; | |
| 2902 | } | ||
| 2903 | //} | ||
| 2904 | |||
| 2905 | 91 | read_ext_zinfo = tempheader.external_zinfo; | |
| 2906 | |||
| 2907 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 91 times.
|
91 | if(keepdata==true) |
| 2908 | { | ||
| 2909 | 91 | memcpy(Header, &tempheader, sizeof(tempheader)); | |
| 2910 | 91 | map_count=temp_map_count; | |
| 2911 | 91 | memcpy(midi_flags, temp_midi_flags, MIDIFLAGS_SIZE); | |
| 2912 | 91 | } | |
| 2913 | |||
| 2914 | 91 | return 0; | |
| 2915 | 91 | } | |
| 2916 | |||
| 2917 | 77 | int32_t readrules(PACKFILE *f, zquestheader *Header, bool keepdata) | |
| 2918 | { | ||
| 2919 | int32_t dummy; | ||
| 2920 | zquestheader tempheader; | ||
| 2921 | 77 | word s_version=0; | |
| 2922 | 77 | dword compatrule_version=0; | |
| 2923 | |||
| 2924 | 77 | memcpy(&tempheader, Header, sizeof(tempheader)); | |
| 2925 | |||
| 2926 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(tempheader.zelda_version >= 0x193) |
| 2927 | { | ||
| 2928 | //section version info | ||
| 2929 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_version,f,true)) |
| 2930 | { | ||
| 2931 | ✗ | return qe_invalid; | |
| 2932 | } | ||
| 2933 | |||
| 2934 | 77 | FFCore.quest_format[vRules] = s_version; | |
| 2935 | |||
| 2936 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&dummy,f,true)) |
| 2937 | { | ||
| 2938 | ✗ | return qe_invalid; | |
| 2939 | } | ||
| 2940 | |||
| 2941 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
|
77 | if(s_version > 16) |
| 2942 | { | ||
| 2943 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(!p_igetl(&compatrule_version,f,true)) |
| 2944 | { | ||
| 2945 | ✗ | return qe_invalid; | |
| 2946 | } | ||
| 2947 | 8 | } | |
| 2948 | 77 | FFCore.quest_format[vCompatRule] = compatrule_version; | |
| 2949 | |||
| 2950 | //section size | ||
| 2951 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&dummy,f,true)) |
| 2952 | { | ||
| 2953 | ✗ | return qe_invalid; | |
| 2954 | } | ||
| 2955 | |||
| 2956 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
|
77 | if ( s_version < 15 ) |
| 2957 | { | ||
| 2958 | //finally... section data | ||
| 2959 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if(!pfread(quest_rules,QUESTRULES_SIZE,f,true)) |
| 2960 | { | ||
| 2961 | ✗ | return qe_invalid; | |
| 2962 | } | ||
| 2963 | 69 | } | |
| 2964 | else | ||
| 2965 | { | ||
| 2966 | |||
| 2967 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(!pfread(quest_rules,QUESTRULES_NEW_SIZE,f,true)) |
| 2968 | { | ||
| 2969 | ✗ | return qe_invalid; | |
| 2970 | } | ||
| 2971 | |||
| 2972 | } | ||
| 2973 | 77 | } | |
| 2974 | |||
| 2975 | //al_trace("Rules version %d\n", s_version); | ||
| 2976 | //{ bunch of compat stuff | ||
| 2977 | 77 | memcpy(deprecated_rules, quest_rules, QUESTRULES_NEW_SIZE); | |
| 2978 | |||
| 2979 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version<2) |
| 2980 | { | ||
| 2981 | ✗ | set_bit(quest_rules,14,0); | |
| 2982 | ✗ | set_bit(quest_rules,27,0); | |
| 2983 | ✗ | set_bit(quest_rules,28,0); | |
| 2984 | ✗ | set_bit(quest_rules,29,0); | |
| 2985 | ✗ | set_bit(quest_rules,30,0); | |
| 2986 | ✗ | set_bit(quest_rules,32,0); | |
| 2987 | ✗ | set_bit(quest_rules,36,0); | |
| 2988 | ✗ | set_bit(quest_rules,49,0); | |
| 2989 | ✗ | set_bit(quest_rules,50,0); | |
| 2990 | ✗ | set_bit(quest_rules,51,0); | |
| 2991 | ✗ | set_bit(quest_rules,68,0); | |
| 2992 | ✗ | set_bit(quest_rules,75,0); | |
| 2993 | ✗ | set_bit(quest_rules,76,0); | |
| 2994 | ✗ | set_bit(quest_rules,98,0); | |
| 2995 | ✗ | set_bit(quest_rules,110,0); | |
| 2996 | ✗ | set_bit(quest_rules,113,0); | |
| 2997 | ✗ | set_bit(quest_rules,116,0); | |
| 2998 | ✗ | set_bit(quest_rules,102,0); | |
| 2999 | ✗ | set_bit(quest_rules,132,0); | |
| 3000 | } | ||
| 3001 | |||
| 3002 | //Now, do any updates... | ||
| 3003 |
2/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if((tempheader.zelda_version < 0x211)||((tempheader.zelda_version == 0x211)&&(tempheader.build<18))) |
| 3004 | { | ||
| 3005 | ✗ | set_bit(quest_rules, qr_SMOOTHVERTICALSCROLLING,1); | |
| 3006 | ✗ | set_bit(quest_rules, qr_REPLACEOPENDOORS, 1); | |
| 3007 | ✗ | set_bit(quest_rules, qr_OLDLENSORDER, 1); | |
| 3008 | ✗ | set_bit(quest_rules, qr_NOFAIRYGUYFIRES, 1); | |
| 3009 | ✗ | set_bit(quest_rules, qr_TRIGGERSREPEAT, 1); | |
| 3010 | } | ||
| 3011 | |||
| 3012 |
2/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if((tempheader.zelda_version < 0x193)||((tempheader.zelda_version == 0x193)&&(tempheader.build<3))) |
| 3013 | { | ||
| 3014 | ✗ | set_bit(quest_rules,qr_WALLFLIERS,1); | |
| 3015 | } | ||
| 3016 | |||
| 3017 |
2/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if((tempheader.zelda_version < 0x193)||((tempheader.zelda_version == 0x193)&&(tempheader.build<4))) |
| 3018 | { | ||
| 3019 | ✗ | set_bit(quest_rules,qr_NOBOMBPALFLASH,1); | |
| 3020 | } | ||
| 3021 | |||
| 3022 |
2/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if((tempheader.zelda_version < 0x193)||((tempheader.zelda_version == 0x193)&&(tempheader.build<3))) |
| 3023 | { | ||
| 3024 | ✗ | set_bit(quest_rules,qr_NOSCROLLCONTINUE,1); | |
| 3025 | } | ||
| 3026 | |||
| 3027 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(tempheader.zelda_version <= 0x210) |
| 3028 | { | ||
| 3029 | ✗ | set_bit(quest_rules,qr_ARROWCLIP,1); | |
| 3030 | } | ||
| 3031 | |||
| 3032 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(tempheader.zelda_version == 0x210) |
| 3033 | { | ||
| 3034 | ✗ | set_bit(quest_rules, qr_NOSCROLLCONTINUE, get_bit(quest_rules, qr_CMBCYCLELAYERS)); | |
| 3035 | ✗ | set_bit(quest_rules, qr_CMBCYCLELAYERS, 0); | |
| 3036 | ✗ | set_bit(quest_rules, qr_CONT_SWORD_TRIGGERS, 1); | |
| 3037 | } | ||
| 3038 | |||
| 3039 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(tempheader.zelda_version <= 0x210) |
| 3040 | { | ||
| 3041 | ✗ | set_bit(quest_rules,qr_OLDSTYLEWARP,1); | |
| 3042 | ✗ | set_bit(quest_rules,qr_210_WARPRETURN,1); | |
| 3043 | } | ||
| 3044 | |||
| 3045 | //might not be correct | ||
| 3046 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(tempheader.zelda_version < 0x210) |
| 3047 | { | ||
| 3048 | ✗ | set_bit(deprecated_rules, qr_OLDTRIBBLES_DEP,1); | |
| 3049 | ✗ | set_bit(quest_rules, qr_OLDHOOKSHOTGRAB,1); | |
| 3050 | } | ||
| 3051 | |||
| 3052 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(tempheader.zelda_version < 0x211) |
| 3053 | { | ||
| 3054 | ✗ | set_bit(quest_rules, qr_WRONG_BRANG_TRAIL_DIR,1); | |
| 3055 | } | ||
| 3056 | |||
| 3057 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
77 | if(tempheader.zelda_version == 0x192 && tempheader.build == 163) |
| 3058 | { | ||
| 3059 | ✗ | set_bit(quest_rules, qr_192b163_WARP,1); | |
| 3060 | } | ||
| 3061 | |||
| 3062 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(tempheader.zelda_version == 0x210) |
| 3063 | { | ||
| 3064 | ✗ | set_bit(deprecated_rules, qr_OLDTRIBBLES_DEP, get_bit(quest_rules, qr_DMGCOMBOPRI)); | |
| 3065 | ✗ | set_bit(quest_rules, qr_DMGCOMBOPRI, 0); | |
| 3066 | } | ||
| 3067 | |||
| 3068 |
2/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if(tempheader.zelda_version < 0x211 || (tempheader.zelda_version == 0x211 && tempheader.build<15)) |
| 3069 | { | ||
| 3070 | ✗ | set_bit(quest_rules, qr_OLDPICKUP,1); | |
| 3071 | } | ||
| 3072 | |||
| 3073 |
2/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if(tempheader.zelda_version < 0x211 || (tempheader.zelda_version == 0x211 && tempheader.build < 18)) |
| 3074 | { | ||
| 3075 | ✗ | set_bit(quest_rules,qr_NOSOLIDDAMAGECOMBOS, 1); | |
| 3076 | ✗ | set_bit(quest_rules, qr_ITEMPICKUPSETSBELOW, 1); // broke around build 400 | |
| 3077 | } | ||
| 3078 | |||
| 3079 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(tempheader.zelda_version < 0x250) // version<0x250 checks for beta 18; build was set to 18 prematurely |
| 3080 | { | ||
| 3081 | ✗ | set_bit(quest_rules,qr_HOOKSHOTDOWNBUG, 1); | |
| 3082 | } | ||
| 3083 | |||
| 3084 |
4/4✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 51 times.
✓ Branch 3 taken 18 times.
|
77 | if(tempheader.zelda_version == 0x250 && tempheader.build == 24) // Annoying... |
| 3085 | { | ||
| 3086 | 18 | set_bit(quest_rules,qr_PEAHATCLOCKVULN, 1); | |
| 3087 | 18 | } | |
| 3088 | |||
| 3089 |
4/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✓ Branch 3 taken 8 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 69 times.
|
77 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 22)) //22 is 2.50.0 RC4. Gotta set the door repair QR... -Dimi |
| 3090 | { | ||
| 3091 | ✗ | set_bit(quest_rules,qr_OLD_DOORREPAIR, 1); | |
| 3092 | } | ||
| 3093 | |||
| 3094 |
4/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✓ Branch 3 taken 8 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 69 times.
|
77 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 20)) //20 is 2.50.0 RC1 and RC2 (cause it didn't get bumped). Okay I'm gonna be honest I have no idea if any 2.50 build was available before RC1, but gonna try and cover my ass here -Dimi |
| 3095 | { | ||
| 3096 | ✗ | set_bit(quest_rules,qr_OLD_SECRETMONEY, 1); | |
| 3097 | } | ||
| 3098 | |||
| 3099 |
5/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 18 times.
✓ Branch 5 taken 51 times.
|
77 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 28)) //28 is 2.50.1 final. Potion bug might have been used, I dunno. -Dimi |
| 3100 | { | ||
| 3101 | 18 | set_bit(quest_rules,qr_OLD_POTION_OR_HC, 1); | |
| 3102 | 18 | } | |
| 3103 | |||
| 3104 |
5/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 18 times.
✓ Branch 5 taken 51 times.
|
77 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<28)) |
| 3105 | { | ||
| 3106 | 18 | set_bit(quest_rules, qr_OFFSCREENWEAPONS, 1); | |
| 3107 | 18 | } | |
| 3108 | |||
| 3109 | //Bombchu fix. | ||
| 3110 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(tempheader.zelda_version == 0x250) |
| 3111 | { | ||
| 3112 |
2/2✓ Branch 0 taken 51 times.
✓ Branch 1 taken 18 times.
|
69 | if ( tempheader.build == 24 ) //2.50.0 |
| 3113 | { | ||
| 3114 | 18 | set_bit(quest_rules, qr_BOMBCHUSUPERBOMB, 1); | |
| 3115 | 18 | } | |
| 3116 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 5 times.
|
69 | if ( tempheader.build == 28 ) //2.50.1 |
| 3117 | { | ||
| 3118 | 5 | set_bit(quest_rules, qr_BOMBCHUSUPERBOMB, 1); | |
| 3119 | 5 | } | |
| 3120 |
2/2✓ Branch 0 taken 46 times.
✓ Branch 1 taken 23 times.
|
69 | if ( tempheader.build == 29 ) //2.50.2 |
| 3121 | { | ||
| 3122 | 23 | set_bit(quest_rules, qr_BOMBCHUSUPERBOMB, 0); | |
| 3123 | 23 | } | |
| 3124 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | if ( tempheader.build == 30 ) //2.50.3RC1 |
| 3125 | { | ||
| 3126 | ✗ | set_bit(quest_rules, qr_BOMBCHUSUPERBOMB, 0); | |
| 3127 | } | ||
| 3128 | 69 | } | |
| 3129 | |||
| 3130 |
5/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 23 times.
✓ Branch 5 taken 46 times.
|
77 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<29)) |
| 3131 | { | ||
| 3132 | // qr_OFFSETEWPNCOLLISIONFIX | ||
| 3133 | // All 'official' quests need this disabled. | ||
| 3134 | // All 2.10 and lower quests need this enabled to preseve compatability. | ||
| 3135 | // All 2.11 - 2.5.1 quests should have it set also, due to a bug in about half of all the betas. | ||
| 3136 | |||
| 3137 | //~Gleeok | ||
| 3138 | 23 | set_bit(quest_rules, qr_OFFSETEWPNCOLLISIONFIX, 1); //This has to be set!!!! | |
| 3139 | |||
| 3140 | // Broke in build 695 | ||
| 3141 |
2/4✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 23 times.
|
23 | if(tempheader.zelda_version>=0x211 && tempheader.build>=18) |
| 3142 | 23 | set_bit(quest_rules, qr_BROKENSTATUES, 1); | |
| 3143 | 23 | } | |
| 3144 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if (tempheader.zelda_version <= 0x190) |
| 3145 | { | ||
| 3146 | ✗ | set_bit(quest_rules, qr_COPIED_SWIM_SPRITES, 1); | |
| 3147 | } | ||
| 3148 |
6/10✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 8 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 8 times.
|
77 | if ( (tempheader.zelda_version == 0x250 && tempheader.build < 33) || tempheader.zelda_version == 0x254 || tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x255 && tempheader.build < 50) ) |
| 3149 | { | ||
| 3150 | 69 | set_bit(quest_rules, qr_OLD_SLASHNEXT_SECRETS, 1); | |
| 3151 | 69 | } | |
| 3152 | |||
| 3153 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if ( (tempheader.zelda_version < 0x211) ) //2.10 water and ladder interaction |
| 3154 | { | ||
| 3155 | ✗ | set_bit(quest_rules, qr_OLD_210_WATER, 1); | |
| 3156 | } | ||
| 3157 | |||
| 3158 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( (tempheader.zelda_version < 0x255 ) || (tempheader.zelda_version == 0x255 && tempheader.build < 51 ) ) //2.10 water and ladder interaction |
| 3159 | { | ||
| 3160 | 69 | set_bit(quest_rules,qr_STEP_IS_FLOAT,0); | |
| 3161 | 69 | } | |
| 3162 | |||
| 3163 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if ( tempheader.zelda_version < 0x250 ) |
| 3164 | { | ||
| 3165 | ✗ | set_bit(quest_rules, qr_8WAY_SHOT_SFX, 1); | |
| 3166 | } | ||
| 3167 | |||
| 3168 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version < 3) |
| 3169 | { | ||
| 3170 | ✗ | set_bit(quest_rules, qr_HOLDNOSTOPMUSIC, 1); | |
| 3171 | ✗ | set_bit(quest_rules, qr_CAVEEXITNOSTOPMUSIC, 1); | |
| 3172 | } | ||
| 3173 | |||
| 3174 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version<4) |
| 3175 | { | ||
| 3176 | ✗ | set_bit(quest_rules,10,0); | |
| 3177 | } | ||
| 3178 | |||
| 3179 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version<5) |
| 3180 | { | ||
| 3181 | ✗ | set_bit(quest_rules,27,0); | |
| 3182 | } | ||
| 3183 | |||
| 3184 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version<6) |
| 3185 | { | ||
| 3186 | ✗ | set_bit(quest_rules,46,0); | |
| 3187 | } | ||
| 3188 | |||
| 3189 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version<7) // January 2008 |
| 3190 | { | ||
| 3191 | ✗ | set_bit(quest_rules,qr_HEARTSREQUIREDFIX,0); | |
| 3192 | ✗ | set_bit(quest_rules,qr_PUSHBLOCKCSETFIX,1); | |
| 3193 | } | ||
| 3194 | |||
| 3195 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(s_version<8) |
| 3196 | { | ||
| 3197 | ✗ | set_bit(quest_rules, 12, 0); | |
| 3198 | } | ||
| 3199 | else | ||
| 3200 | { | ||
| 3201 | 77 | set_bit(deprecated_rules, 12, 0); | |
| 3202 | } | ||
| 3203 | |||
| 3204 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version<9) // October 2008 |
| 3205 | { | ||
| 3206 | ✗ | set_bit(quest_rules,qr_NOROPE2FLASH_DEP,0); | |
| 3207 | ✗ | set_bit(quest_rules,qr_NOBUBBLEFLASH_DEP,0); | |
| 3208 | ✗ | set_bit(quest_rules,qr_GHINI2BLINK_DEP,0); | |
| 3209 | ✗ | set_bit(quest_rules,qr_PHANTOMGHINI2_DEP,0); | |
| 3210 | } | ||
| 3211 | |||
| 3212 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version<10) // December 2008 |
| 3213 | { | ||
| 3214 | ✗ | set_bit(quest_rules,qr_NOCLOCKS_DEP,0); | |
| 3215 | ✗ | set_bit(quest_rules, qr_ALLOW10RUPEEDROPS_DEP,0); | |
| 3216 | } | ||
| 3217 | |||
| 3218 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version<11) // April 2009 |
| 3219 | { | ||
| 3220 | ✗ | set_bit(quest_rules,qr_SLOWENEMYANIM_DEP,0); | |
| 3221 | } | ||
| 3222 | |||
| 3223 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version<12) // December 2009 |
| 3224 | { | ||
| 3225 | ✗ | set_bit(quest_rules,qr_BRKBLSHLDS_DEP,0); | |
| 3226 | ✗ | set_bit(quest_rules, qr_OLDTRIBBLES_DEP,0); | |
| 3227 | } | ||
| 3228 | |||
| 3229 | //if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 24)) | ||
| 3230 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version < 13) |
| 3231 | { | ||
| 3232 | ✗ | set_bit(quest_rules,qr_SHOPCHEAT, 1); | |
| 3233 | } | ||
| 3234 | |||
| 3235 | // Not entirely sure this is the best place for this... | ||
| 3236 | //2.50.2 bitmap offset fix | ||
| 3237 | 77 | memset(extra_rules, 0, EXTRARULES_SIZE); | |
| 3238 |
5/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 23 times.
✓ Branch 5 taken 46 times.
|
77 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<29)) |
| 3239 | { | ||
| 3240 | 23 | set_bit(extra_rules, er_BITMAPOFFSET, 1); | |
| 3241 | 23 | set_bit(quest_rules, qr_BITMAPOFFSETFIX, 1); | |
| 3242 | 23 | } | |
| 3243 | //required because quest templates also used this bit, although | ||
| 3244 | //it never did anything, before. -Z | ||
| 3245 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if ( tempheader.zelda_version == 0x250 ) |
| 3246 | { | ||
| 3247 |
5/6✓ Branch 0 taken 46 times.
✓ Branch 1 taken 23 times.
✓ Branch 2 taken 46 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 15 times.
✓ Branch 5 taken 31 times.
|
69 | if( tempheader.build == 29 || tempheader.build == 30 || tempheader.build == 31 ) |
| 3248 | { | ||
| 3249 | 38 | set_bit(extra_rules, er_BITMAPOFFSET, 0); | |
| 3250 | 38 | set_bit(quest_rules, qr_BITMAPOFFSETFIX, 0); | |
| 3251 | 38 | } | |
| 3252 | 69 | } | |
| 3253 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if ( tempheader.zelda_version == 0x254 ) |
| 3254 | { | ||
| 3255 | ✗ | set_bit(extra_rules, er_BITMAPOFFSET, 0); | |
| 3256 | ✗ | set_bit(quest_rules, qr_BITMAPOFFSETFIX, 0); | |
| 3257 | } | ||
| 3258 |
3/4✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
77 | if ( tempheader.zelda_version == 0x255 && tempheader.build < 42 ) //QR was added to 255 in this build. |
| 3259 | { | ||
| 3260 | ✗ | set_bit(extra_rules, er_BITMAPOFFSET, 0); | |
| 3261 | ✗ | set_bit(quest_rules, qr_BITMAPOFFSETFIX, 0); | |
| 3262 | } | ||
| 3263 | //optimise fast drawing for older versions. | ||
| 3264 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 42) ) |
| 3265 | { | ||
| 3266 | 69 | set_bit(quest_rules, qr_OLDSPRITEDRAWS, 1); | |
| 3267 | 69 | } | |
| 3268 | //Old eweapon->Parent (was added in 2.54, Alpha 19) | ||
| 3269 | //The change was made in build 43, but I'm setting this to < 42, because quests made in 42 would benefit from this change, and | ||
| 3270 | //older quests can set the rule by hand. We need a new qst.dat again. | ||
| 3271 |
4/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 69 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( tempheader.zelda_version == 0x254 || (tempheader.zelda_version == 0x255 && tempheader.build < 42) ) |
| 3272 | { | ||
| 3273 | ✗ | set_bit(quest_rules, qr_OLDEWPNPARENT, 1); | |
| 3274 | } | ||
| 3275 |
4/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 69 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( tempheader.zelda_version == 0x254 || (tempheader.zelda_version == 0x255 && tempheader.build < 44) ) |
| 3276 | { | ||
| 3277 | ✗ | set_bit(quest_rules, qr_OLDCREATEBITMAP_ARGS, 1); | |
| 3278 | } | ||
| 3279 |
4/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 69 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( tempheader.zelda_version == 0x254 || (tempheader.zelda_version == 0x255 && tempheader.build < 45) ) |
| 3280 | { | ||
| 3281 | ✗ | set_bit(quest_rules, qr_OLDQUESTMISC, 1); | |
| 3282 | } | ||
| 3283 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if ( tempheader.zelda_version < 0x254 ) |
| 3284 | { | ||
| 3285 | 69 | set_bit(quest_rules, qr_OLDCREATEBITMAP_ARGS, 0); | |
| 3286 | 69 | set_bit(quest_rules, qr_OLDEWPNPARENT, 0); | |
| 3287 | 69 | set_bit(quest_rules, qr_OLDQUESTMISC, 0); | |
| 3288 | 69 | } | |
| 3289 | |||
| 3290 | //item scripts continue to run | ||
| 3291 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 44) ) |
| 3292 | { | ||
| 3293 | 69 | set_bit(quest_rules, qr_ITEMSCRIPTSKEEPRUNNING, 0); | |
| 3294 | 69 | set_bit(quest_rules, qr_SCRIPTSRUNINHEROSTEPFORWARD, 0); | |
| 3295 | 69 | set_bit(quest_rules, qr_FIXSCRIPTSDURINGSCROLLING, 0); | |
| 3296 | 69 | set_bit(quest_rules, qr_SCRIPTDRAWSINWARPS, 0); | |
| 3297 | 69 | set_bit(quest_rules, qr_DYINGENEMYESDONTHURTHERO, 0); | |
| 3298 | 69 | set_bit(quest_rules, qr_OUTOFBOUNDSENEMIES, 0); | |
| 3299 | 69 | set_bit(quest_rules, qr_SPRITEXY_IS_FLOAT, 0); | |
| 3300 | 69 | } | |
| 3301 | |||
| 3302 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 46) ) |
| 3303 | { | ||
| 3304 | 69 | set_bit(quest_rules, qr_CLEARINITDONSCRIPTCHANGE, 1); | |
| 3305 | 69 | } | |
| 3306 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 46) ) |
| 3307 | { | ||
| 3308 | 69 | set_bit(quest_rules, qr_TRACESCRIPTIDS, 0); | |
| 3309 | 69 | set_bit(quest_rules, qr_SCRIPT_FRIENDLY_ENEMY_TYPES, 1); | |
| 3310 | 69 | set_bit(quest_rules, qr_PARSER_BOOL_TRUE_DECIMAL, 1); | |
| 3311 | 69 | set_bit(quest_rules,qr_PARSER_250DIVISION,1); | |
| 3312 | 69 | set_bit(quest_rules,qr_PARSER_BOOL_TRUE_DECIMAL,1); | |
| 3313 | 69 | set_bit(quest_rules,qr_PARSER_TRUE_INT_SIZE,0); | |
| 3314 | 69 | set_bit(quest_rules,qr_PARSER_FORCE_INLINE,0); | |
| 3315 | 69 | set_bit(quest_rules,qr_PARSER_BINARY_32BIT,0); | |
| 3316 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | if ( get_bit(quest_rules, qr_SELECTAWPN) ) |
| 3317 | { | ||
| 3318 | ✗ | set_bit(quest_rules,qr_NO_L_R_BUTTON_INVENTORY_SWAP,1); | |
| 3319 | //In < 2.55a27, if you had an A+B subscreen, L and R didn't shift through inventory. | ||
| 3320 | //Now they **do**, unless you disable that behaviour. | ||
| 3321 | //For the sake of compatibility, old quests with the A+B subscreen rule enabed | ||
| 3322 | //now enable the disable L/R item swap on load. | ||
| 3323 | } | ||
| 3324 | |||
| 3325 | 69 | } | |
| 3326 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 47) ) |
| 3327 | { | ||
| 3328 | //Compatibility: Setting the hero's action to rafting was previously disallowed, though legal for scripts to attempt. | ||
| 3329 | 69 | set_bit(quest_rules, qr_DISALLOW_SETTING_RAFTING, 1); | |
| 3330 | //Compatibility: The calculation for when to loop an animation did not factor in ASkipY correctly, resulting in | ||
| 3331 | //animations ending earlier than they should. | ||
| 3332 | 69 | set_bit(quest_rules, qr_BROKEN_ASKIP_Y_FRAMES, 1); | |
| 3333 | //Enemies would ignore solidity on the top half of combos | ||
| 3334 | 69 | set_bit(quest_rules, qr_ENEMY_BROKEN_TOP_HALF_SOLIDITY, 1); | |
| 3335 | //Ceiling collison was a bit wonky, including hitting your head before you are near the ceiling or clipping into it slightly. | ||
| 3336 | 69 | set_bit(quest_rules, qr_OLD_SIDEVIEW_CEILING_COLLISON, 1); | |
| 3337 | //If an itemdata had a 'frames' of 0, items created of that data would ignore all changes to 'frames' | ||
| 3338 | 69 | set_bit(quest_rules, qr_0AFRAME_ITEMS_IGNORE_AFRAME_CHANGES, 1); | |
| 3339 | //Collision used some odd calculations before, and enemies could not be hit back into the top row or left column | ||
| 3340 | 69 | set_bit(quest_rules, qr_OLD_ENEMY_KNOCKBACK_COLLISION, 1); | |
| 3341 | 69 | } | |
| 3342 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if ( tempheader.zelda_version < 0x255 ) |
| 3343 | { | ||
| 3344 | 69 | set_bit(quest_rules, qr_NOFFCWAITDRAW, 1); | |
| 3345 | 69 | set_bit(quest_rules, qr_NOITEMWAITDRAW, 1); | |
| 3346 | 69 | set_bit(quest_rules, qr_SETENEMYWEAPONSPRITESONWPNCHANGE, 1); | |
| 3347 | 69 | set_bit(quest_rules, qr_OLD_INIT_SCRIPT_TIMING, 1); | |
| 3348 | //set_bit(quest_rules, qr_DO_NOT_DEALLOCATE_INIT_AND_SAVELOAD_ARRAYS, 1); | ||
| 3349 | 69 | } | |
| 3350 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( tempheader.zelda_version < 0x255 || ( tempheader.zelda_version == 0x255 && tempheader.build < 48 ) ) |
| 3351 | { | ||
| 3352 | 69 | set_bit(quest_rules, qr_SETENEMYWEAPONSPRITESONWPNCHANGE, 1); | |
| 3353 | 69 | } | |
| 3354 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if( tempheader.zelda_version < 0x255 || ( tempheader.zelda_version == 0x255 && tempheader.build < 52 ) ) |
| 3355 | { | ||
| 3356 | 69 | set_bit(quest_rules, qr_OLD_PRINTF_ARGS, 1); | |
| 3357 | 69 | } | |
| 3358 | |||
| 3359 | |||
| 3360 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 54) ) |
| 3361 | { | ||
| 3362 | 69 | set_bit(quest_rules, qr_BROKEN_RING_POWER, 1); | |
| 3363 | 69 | } | |
| 3364 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 56) ) |
| 3365 | { | ||
| 3366 | 69 | set_bit(quest_rules, qr_NO_OVERWORLD_MAP_CHARTING, 1); | |
| 3367 | 69 | } | |
| 3368 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 57) ) |
| 3369 | { | ||
| 3370 | 69 | set_bit(quest_rules, qr_DUNGEONS_USE_CLASSIC_CHARTING, 1); | |
| 3371 | 69 | } | |
| 3372 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 58) ) |
| 3373 | { | ||
| 3374 | //Rule used to be 'qr_SETXYBUTTONITEMS', now split. | ||
| 3375 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | if(get_bit(quest_rules,qr_SET_XBUTTON_ITEMS)) |
| 3376 | ✗ | set_bit(quest_rules,qr_SET_YBUTTON_ITEMS,1); | |
| 3377 | 69 | } | |
| 3378 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 59) ) |
| 3379 | { | ||
| 3380 | 69 | set_bit(quest_rules,qr_ALLOW_EDITING_COMBO_0,1); | |
| 3381 | 69 | } | |
| 3382 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 60) ) |
| 3383 | { | ||
| 3384 | 69 | set_bit(quest_rules,qr_OLD_CHEST_COLLISION,1); | |
| 3385 | 69 | } | |
| 3386 | |||
| 3387 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if ( tempheader.zelda_version < 0x254 ) |
| 3388 | { | ||
| 3389 | 69 | set_bit(quest_rules, qr_250WRITEEDEFSCRIPT, 1); | |
| 3390 | 69 | } | |
| 3391 | //Sideview spikes in 2.50.0 | ||
| 3392 |
5/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 18 times.
✓ Branch 5 taken 51 times.
|
77 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<27)) //2.50.1RC3 |
| 3393 | { | ||
| 3394 | 18 | set_bit(quest_rules, qr_OLDSIDEVIEWSPIKES, 1); | |
| 3395 | 18 | } | |
| 3396 | //more 2.50 fixes -Z | ||
| 3397 |
5/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 46 times.
✓ Branch 5 taken 23 times.
|
77 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<31)) |
| 3398 | { | ||
| 3399 | 46 | set_bit(quest_rules, qr_MELEEMAGICCOST, 0); | |
| 3400 | 46 | set_bit(quest_rules, qr_GANONINTRO, 0); //This will get flipped later on in the compatrule 11 check. That's why it's turning it off. | |
| 3401 | 46 | set_bit(quest_rules, qr_OLDMIRRORCOMBOS, 1); | |
| 3402 | 46 | set_bit(quest_rules, qr_BROKENBOOKCOST, 1); | |
| 3403 | 46 | set_bit(quest_rules, qr_BROKENCHARINTDRAWING, 1); | |
| 3404 | |||
| 3405 | 46 | } | |
| 3406 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
77 | if(tempheader.zelda_version == 0x254 && tempheader.build<41) |
| 3407 | { | ||
| 3408 | //set_bit(quest_rules,qr_MELEEMAGICCOST, get_bit(extra_rules,er_MAGICCOSTSWORD)); | ||
| 3409 | ✗ | set_bit(quest_rules,qr_MELEEMAGICCOST, 1); | |
| 3410 | } | ||
| 3411 | |||
| 3412 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(tempheader.zelda_version < 0x193) |
| 3413 | { | ||
| 3414 | ✗ | set_bit(quest_rules, qr_SHORTDGNWALK, 1); | |
| 3415 | } | ||
| 3416 | |||
| 3417 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(tempheader.zelda_version < 0x255) |
| 3418 | { | ||
| 3419 | 69 | set_bit(quest_rules, qr_OLDINFMAGIC, 1); | |
| 3420 | 69 | } | |
| 3421 | |||
| 3422 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if((tempheader.zelda_version < 0x250)) //2.10 and earlier allowed the triforce to Warp Player out of Item Cellars in Dungeons. -Z (15th March, 2019 ) |
| 3423 | { | ||
| 3424 | ✗ | set_bit(quest_rules,qr_SIDEVIEWTRIFORCECELLAR,1); | |
| 3425 | } | ||
| 3426 | |||
| 3427 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 47) ) |
| 3428 | { | ||
| 3429 | 69 | set_bit(quest_rules,qr_OLD_F6,1); | |
| 3430 | 69 | } | |
| 3431 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 49) ) |
| 3432 | { | ||
| 3433 | 69 | set_bit(quest_rules,qr_NO_OVERWRITING_HOPPING,1); | |
| 3434 | 69 | } | |
| 3435 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 50) ) |
| 3436 | { | ||
| 3437 | 69 | set_bit(quest_rules,qr_STRING_FRAME_OLD_WIDTH_HEIGHT,1); | |
| 3438 | 69 | } | |
| 3439 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 53) ) |
| 3440 | { | ||
| 3441 | 69 | set_bit(quest_rules,qr_BROKEN_OVERWORLD_MINIMAP,1); | |
| 3442 | 69 | } | |
| 3443 | //} | ||
| 3444 | |||
| 3445 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 1) |
| 3446 | { | ||
| 3447 | //Enemies->Secret only affects flag 16-31 | ||
| 3448 | 69 | set_bit(quest_rules,qr_ENEMIES_SECRET_ONLY_16_31,1); | |
| 3449 | 69 | } | |
| 3450 | |||
| 3451 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 2) |
| 3452 | { | ||
| 3453 | //Old CSet2 Handling | ||
| 3454 | 69 | set_bit(quest_rules,qr_OLDCS2,1); | |
| 3455 | 69 | } | |
| 3456 | |||
| 3457 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 3) |
| 3458 | { | ||
| 3459 | //Hardcoded Shadow/Spawn/Death anim frames | ||
| 3460 | 69 | set_bit(quest_rules,qr_HARDCODED_ENEMY_ANIMS,1); | |
| 3461 | 69 | } | |
| 3462 | |||
| 3463 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 4) |
| 3464 | { | ||
| 3465 | //Hardcoded Shadow/Spawn/Death anim frames | ||
| 3466 | 69 | set_bit(quest_rules,qr_OLD_ITEMDATA_SCRIPT_TIMING,1); | |
| 3467 | 69 | } | |
| 3468 | |||
| 3469 |
3/4✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 69 times.
|
77 | if(compatrule_version < 5 && tempheader.zelda_version >= 0x250) |
| 3470 | { | ||
| 3471 | //Hardcoded Shadow/Spawn/Death anim frames | ||
| 3472 | 69 | set_bit(quest_rules,qr_NO_LANMOLA_RINGLEADER,1); | |
| 3473 | 69 | } | |
| 3474 | |||
| 3475 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 6) |
| 3476 | { | ||
| 3477 | //Step->Secret (Temp) only affects flag 16-31 | ||
| 3478 | 69 | set_bit(quest_rules,qr_STEPTEMP_SECRET_ONLY_16_31,1); | |
| 3479 | 69 | } | |
| 3480 | |||
| 3481 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 7) |
| 3482 | { | ||
| 3483 | //'Hit All Triggers->Perm Secret' doesn't trigger temp secrets | ||
| 3484 | 69 | set_bit(quest_rules,qr_ALLTRIG_PERMSEC_NO_TEMP,1); | |
| 3485 | 69 | } | |
| 3486 | |||
| 3487 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 8) |
| 3488 | { | ||
| 3489 | //Hardcoded LItem/Bomb/Clock/Magic Tile Mods | ||
| 3490 | 69 | set_bit(quest_rules,qr_HARDCODED_LITEM_LTMS,1); | |
| 3491 | 69 | } | |
| 3492 | |||
| 3493 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 9) |
| 3494 | { | ||
| 3495 | //Hardcoded BS Patras | ||
| 3496 | 69 | set_bit(quest_rules,qr_HARDCODED_BS_PATRA,1); | |
| 3497 | //Hardcoded Patra Inner Eye offsets | ||
| 3498 | 69 | set_bit(quest_rules,qr_PATRAS_USE_HARDCODED_OFFSETS,1); | |
| 3499 | //Broken 'Big enemy' animation style | ||
| 3500 | 69 | set_bit(quest_rules,qr_BROKEN_BIG_ENEMY_ANIMATION,1); | |
| 3501 | //Broken Attribute 31/32 | ||
| 3502 | 69 | set_bit(quest_rules,qr_BROKEN_ATTRIBUTE_31_32,1); | |
| 3503 | 69 | } | |
| 3504 | |||
| 3505 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 10) |
| 3506 | { | ||
| 3507 | //Shared candle use limits | ||
| 3508 | 69 | set_bit(quest_rules,qr_CANDLES_SHARED_LIMIT,1); | |
| 3509 | 69 | } | |
| 3510 | |||
| 3511 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 11) |
| 3512 | { | ||
| 3513 | //No cross-screen return points | ||
| 3514 | 69 | set_bit(quest_rules,qr_OLD_RESPAWN_POINTS,1); | |
| 3515 | 69 | } | |
| 3516 | |||
| 3517 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 12) |
| 3518 | { | ||
| 3519 | //Old fire trail duration | ||
| 3520 | 69 | set_bit(quest_rules,qr_OLD_FLAMETRAIL_DURATION,1); | |
| 3521 | //Old Intro String in Ganon Room Behavior | ||
| 3522 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if(get_bit(quest_rules,qr_GANONINTRO)) set_bit(quest_rules,qr_GANONINTRO,0); |
| 3523 | 69 | else set_bit(quest_rules,qr_GANONINTRO,1); | |
| 3524 | 69 | } | |
| 3525 | |||
| 3526 |
3/4✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 69 times.
✗ Branch 3 not taken.
|
77 | if(compatrule_version < 13 && tempheader.zelda_version >= 0x255) |
| 3527 | { | ||
| 3528 | //ANone doesn't reset to originaltile | ||
| 3529 | ✗ | set_bit(quest_rules,qr_ANONE_NOANIM,1); | |
| 3530 | } | ||
| 3531 | |||
| 3532 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 14) |
| 3533 | { | ||
| 3534 | //Old Bridge Combo Behavior | ||
| 3535 | 69 | set_bit(quest_rules,qr_OLD_BRIDGE_COMBOS,1); | |
| 3536 | 69 | } | |
| 3537 | |||
| 3538 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 15) |
| 3539 | { | ||
| 3540 | //Broken Z3 Animation | ||
| 3541 | 69 | set_bit(quest_rules,qr_BROKEN_Z3_ANIMATION,1); | |
| 3542 | 69 | } | |
| 3543 | |||
| 3544 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 16) |
| 3545 | { | ||
| 3546 | //Old Enemy Tile Behavior with Animation (None) Enemies | ||
| 3547 | 69 | set_bit(quest_rules,qr_OLD_TILE_INITIALIZATION,1); | |
| 3548 | 69 | } | |
| 3549 | |||
| 3550 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 17) |
| 3551 | { | ||
| 3552 | //Old Quake/DrawYOffset behavior | ||
| 3553 | //set_bit(quest_rules,qr_OLD_DRAWOFFSET,1); | ||
| 3554 | //I'm leaving this commented cause I doubt it'll break anything and I think the bugfix might be appreciated in older versions. | ||
| 3555 | //On the offchance that it *does* break old quests, fixing it is as simple as uncommenting the set_bit above. | ||
| 3556 | 69 | } | |
| 3557 | |||
| 3558 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 18) |
| 3559 | { | ||
| 3560 | //Broken DrawScreen Derivative Functions | ||
| 3561 | 69 | set_bit(quest_rules,qr_BROKEN_DRAWSCREEN_FUNCTIONS,1); | |
| 3562 | //Scrolling Cancels Charge | ||
| 3563 | 69 | set_bit(quest_rules,qr_SCROLLING_KILLS_CHARGE,1); | |
| 3564 | 69 | } | |
| 3565 | |||
| 3566 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 19) |
| 3567 | { | ||
| 3568 | //Broken Enemy Item Carrying with Large Enemies | ||
| 3569 | 69 | set_bit(quest_rules,qr_BROKEN_ITEM_CARRYING,1); | |
| 3570 | 69 | } | |
| 3571 | |||
| 3572 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 20) |
| 3573 | { | ||
| 3574 | 69 | set_bit(quest_rules,qr_CUSTOMWEAPON_IGNORE_COST,1); | |
| 3575 | 69 | } | |
| 3576 | |||
| 3577 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 21) |
| 3578 | { | ||
| 3579 | 69 | set_bit(quest_rules,qr_LEEVERS_DONT_OBEY_STUN,1); | |
| 3580 | 69 | set_bit(quest_rules,qr_GANON_CANT_SPAWN_ON_CONTINUE,1); | |
| 3581 | 69 | set_bit(quest_rules,qr_WIZZROBES_DONT_OBEY_STUN,1); | |
| 3582 | 69 | set_bit(quest_rules,qr_OLD_BUG_NET,1); | |
| 3583 | 69 | set_bit(quest_rules,qr_MANHANDLA_BLOCK_SFX,1); | |
| 3584 | 69 | } | |
| 3585 | |||
| 3586 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 22) |
| 3587 | { | ||
| 3588 | 69 | set_bit(quest_rules,qr_BROKEN_KEEPOLD_FLAG,1); | |
| 3589 | 69 | } | |
| 3590 | |||
| 3591 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 23) |
| 3592 | { | ||
| 3593 | 69 | set_bit(quest_rules,qr_OLD_HALF_MAGIC,1); | |
| 3594 | 69 | } | |
| 3595 | |||
| 3596 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 24) |
| 3597 | { | ||
| 3598 | 69 | set_bit(quest_rules,qr_WARPS_RESTART_DMAPSCRIPT,1); | |
| 3599 | 69 | set_bit(quest_rules,qr_DMAP_0_CONTINUE_BUG,1); | |
| 3600 | 69 | } | |
| 3601 | |||
| 3602 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 25) |
| 3603 | { | ||
| 3604 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if (get_bit(quest_rules, qr_OLD_FAIRY_LIMIT)) set_bit(quest_rules,qr_OLD_FAIRY_LIMIT,0); |
| 3605 | 69 | else set_bit(quest_rules,qr_OLD_FAIRY_LIMIT,1); | |
| 3606 | 69 | set_bit(quest_rules,qr_OLD_SCRIPTED_KNOCKBACK,1); | |
| 3607 | 69 | } | |
| 3608 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 26) |
| 3609 | { | ||
| 3610 | 69 | set_bit(quest_rules,qr_OLD_KEESE_Z_AXIS,1); | |
| 3611 | 69 | set_bit(quest_rules,qr_POLVIRE_NO_SHADOW,1); | |
| 3612 | 69 | set_bit(quest_rules,qr_SUBSCR_OLD_SELECTOR,1); | |
| 3613 | 69 | } | |
| 3614 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(compatrule_version < 27) //Noticed some junk data in the QR array... |
| 3615 | { | ||
| 3616 |
2/2✓ Branch 0 taken 20769 times.
✓ Branch 1 taken 69 times.
|
20838 | for(auto q = qr_POLVIRE_NO_SHADOW+1; q < qr_PARSER_250DIVISION; ++q) |
| 3617 | 20769 | set_bit(quest_rules,q,0); | |
| 3618 |
2/2✓ Branch 0 taken 7728 times.
✓ Branch 1 taken 69 times.
|
7797 | for(auto q = qr_COMBODATA_INITD_MULT_TENK+1; q < QUESTRULES_NEW_SIZE*8; ++q) |
| 3619 | 7728 | set_bit(quest_rules,q,0); | |
| 3620 | //This should nuke any remaining junk data... not sure if it affected anything previous. -Em | ||
| 3621 | 69 | } | |
| 3622 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 70 times.
|
77 | if(compatrule_version < 28) |
| 3623 | { | ||
| 3624 | 70 | set_bit(quest_rules,qr_SUBSCR_BACKWARDS_ID_ORDER,1); | |
| 3625 | 70 | } | |
| 3626 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 70 times.
|
77 | if(compatrule_version < 29) |
| 3627 | { | ||
| 3628 | 70 | set_bit(quest_rules,qr_OLD_LOCKBLOCK_COLLISION,1); | |
| 3629 | 70 | } | |
| 3630 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 70 times.
|
77 | if(compatrule_version < 30) |
| 3631 | { | ||
| 3632 | 70 | set_bit(quest_rules,qr_DECO_2_YOFFSET,1); | |
| 3633 | 70 | set_bit(quest_rules,qr_SCREENSTATE_80s_BUG,1); | |
| 3634 | 70 | } | |
| 3635 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 70 times.
|
77 | if(compatrule_version < 31) |
| 3636 | { | ||
| 3637 | 70 | set_bit(quest_rules,qr_GOHMA_UNDAMAGED_BUG,1); | |
| 3638 | 70 | set_bit(quest_rules,qr_FFCPRELOAD_BUGGED_LOAD,1); | |
| 3639 | 70 | } | |
| 3640 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 70 times.
|
77 | if(compatrule_version < 32) |
| 3641 | { | ||
| 3642 | 70 | set_bit(quest_rules,qr_BROKEN_GETPIXEL_VALUE,1); | |
| 3643 | 70 | } | |
| 3644 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 70 times.
|
77 | if(compatrule_version < 33) |
| 3645 | { | ||
| 3646 | 70 | set_bit(quest_rules,qr_NO_LIFT_SPRITE,1); | |
| 3647 | 70 | } | |
| 3648 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 75 times.
|
77 | if(compatrule_version < 34) |
| 3649 | { | ||
| 3650 | 75 | set_bit(quest_rules,qr_OLD_SIDEVIEW_LANDING_CODE,1); | |
| 3651 | 75 | set_bit(quest_rules,qr_OLD_FFC_SPEED_CAP,1); | |
| 3652 | 75 | set_bit(quest_rules,qr_OLD_FFC_FUNCTIONALITY,1); | |
| 3653 | 75 | set_bit(quest_rules,qr_OLD_WIZZROBE_SUBMERGING,1); | |
| 3654 | 75 | } | |
| 3655 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(compatrule_version < 35) |
| 3656 | { | ||
| 3657 | // Leaving this commented for now, might need to enable later -Em | ||
| 3658 | // set_bit(quest_rules,qr_ZS_NO_NEG_ARRAY,1); | ||
| 3659 | 77 | } | |
| 3660 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(compatrule_version < 36) |
| 3661 | { | ||
| 3662 | 77 | set_bit(quest_rules,qr_OLD_SHALLOW_SFX,1); | |
| 3663 | 77 | } | |
| 3664 | |||
| 3665 | //always set | ||
| 3666 | 77 | set_bit(quest_rules,qr_ANIMATECUSTOMWEAPONS,0); | |
| 3667 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if (s_version < 16) set_bit(quest_rules,qr_BROKEN_HORIZONTAL_WEAPON_ANIM,1); |
| 3668 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata==true) |
| 3669 | { | ||
| 3670 | 77 | memcpy(Header, &tempheader, sizeof(tempheader)); | |
| 3671 | 77 | } | |
| 3672 | 77 | return 0; | |
| 3673 | 77 | } | |
| 3674 | |||
| 3675 | 635510 | void init_msgstr(MsgStr *str) | |
| 3676 | { | ||
| 3677 | 635510 | str->s = ""; | |
| 3678 | 635510 | str->s.shrink_to_fit(); | |
| 3679 | 635510 | str->nextstring=0; | |
| 3680 | 635510 | str->tile=0; | |
| 3681 | 635510 | str->cset=0; | |
| 3682 | 635510 | str->trans=false; | |
| 3683 | 635510 | str->font=font_zfont; | |
| 3684 | 635510 | str->y=32; | |
| 3685 | 635510 | str->sfx=18; | |
| 3686 | 635510 | str->listpos=0; | |
| 3687 | 635510 | str->x=24; | |
| 3688 | 635510 | str->w=get_bit(quest_rules,qr_STRING_FRAME_OLD_WIDTH_HEIGHT)!=0 ? 24*8 : 26*8; | |
| 3689 | 635510 | str->h=get_bit(quest_rules,qr_STRING_FRAME_OLD_WIDTH_HEIGHT)!=0 ? 3*8 : 5*8; | |
| 3690 | 635510 | str->hspace=0; | |
| 3691 | 635510 | str->vspace=0; | |
| 3692 | 635510 | str->stringflags=0; | |
| 3693 | 635510 | str->margins[up] = 8; | |
| 3694 | 635510 | str->margins[down] = 0; | |
| 3695 | 635510 | str->margins[left] = 8; | |
| 3696 | 635510 | str->margins[right] = 0; | |
| 3697 | 635510 | str->portrait_tile = 0; | |
| 3698 | 635510 | str->portrait_cset = 0; | |
| 3699 | 635510 | str->portrait_x = 0; | |
| 3700 | 635510 | str->portrait_y = 0; | |
| 3701 | 635510 | str->portrait_tw = 1; | |
| 3702 | 635510 | str->portrait_th = 1; | |
| 3703 | 635510 | str->shadow_type = 0; | |
| 3704 | 635510 | str->shadow_color = 0; | |
| 3705 | 635510 | str->drawlayer = 6; | |
| 3706 | 635510 | } | |
| 3707 | |||
| 3708 | 77 | void init_msgstrings(int32_t start, int32_t end) | |
| 3709 | { | ||
| 3710 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | if(end <= start || end-start > msg_strings_size) |
| 3711 | ✗ | return; | |
| 3712 | |||
| 3713 |
2/2✓ Branch 0 taken 630784 times.
✓ Branch 1 taken 77 times.
|
630861 | for(int32_t i=start; i<end; i++) |
| 3714 | { | ||
| 3715 | 630784 | init_msgstr(&MsgStrings[i]); | |
| 3716 | 630784 | MsgStrings[i].listpos=i; | |
| 3717 | 630784 | } | |
| 3718 | |||
| 3719 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(start==0) |
| 3720 | { | ||
| 3721 | 77 | MsgStrings[0].s = "(None)"; | |
| 3722 | 77 | MsgStrings[0].listpos = 0; | |
| 3723 | 77 | } | |
| 3724 | 77 | } | |
| 3725 | |||
| 3726 | 77 | int32_t readstrings(PACKFILE *f, zquestheader *Header, bool keepdata) | |
| 3727 | { | ||
| 3728 | 77 | MsgStr tempMsgString; | |
| 3729 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | init_msgstr(&tempMsgString); |
| 3730 | |||
| 3731 | 77 | word temp_msg_count=0; | |
| 3732 | word temp_expansion[16]; | ||
| 3733 | 77 | memset(temp_expansion, 0, 16*sizeof(word)); | |
| 3734 | 77 | char buf[8193] = {0}; | |
| 3735 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(Header->zelda_version < 0x193) |
| 3736 | { | ||
| 3737 | byte tempbyte; | ||
| 3738 | ✗ | int32_t strings_to_read=0; | |
| 3739 | ✗ | set_bit(quest_rules,qr_OLD_STRING_EDITOR_MARGINS,true); | |
| 3740 | ✗ | if((Header->zelda_version < 0x192)|| | |
| 3741 | ✗ | ((Header->zelda_version == 0x192)&&(Header->build<31))) | |
| 3742 | { | ||
| 3743 | ✗ | strings_to_read=128; | |
| 3744 | ✗ | temp_msg_count=Header->old_str_count; | |
| 3745 | |||
| 3746 | // Some sort of string count corruption seems to be common in old quests | ||
| 3747 | ✗ | if(temp_msg_count>128) | |
| 3748 | { | ||
| 3749 | ✗ | temp_msg_count=128; | |
| 3750 | } | ||
| 3751 | } | ||
| 3752 | ✗ | else if((Header->zelda_version == 0x192)&&(Header->build<140)) | |
| 3753 | { | ||
| 3754 | ✗ | strings_to_read=255; | |
| 3755 | ✗ | temp_msg_count=Header->old_str_count; | |
| 3756 | } | ||
| 3757 | else | ||
| 3758 | { | ||
| 3759 | ✗ | if(!p_igetw(&temp_msg_count,f,true)) | |
| 3760 | { | ||
| 3761 | ✗ | return qe_invalid; | |
| 3762 | } | ||
| 3763 | |||
| 3764 | ✗ | strings_to_read=temp_msg_count; | |
| 3765 | |||
| 3766 | ✗ | if(temp_msg_count >= msg_strings_size) | |
| 3767 | { | ||
| 3768 | ✗ | Z_message("Reallocating string buffer...\n"); | |
| 3769 | |||
| 3770 | // if((MsgStrings=(MsgStr*)_al_sane_realloc(MsgStrings,sizeof(MsgStr)*MAXMSGS))==NULL) | ||
| 3771 | // return qe_nomem; | ||
| 3772 | |||
| 3773 | //memset(MsgStrings, 0, sizeof(MsgStr)*MAXMSGS); | ||
| 3774 | ✗ | delete[] MsgStrings; | |
| 3775 | ✗ | MsgStrings = new MsgStr[MAXMSGS]; | |
| 3776 | ✗ | msg_strings_size = MAXMSGS; | |
| 3777 | ✗ | for(auto q = 0; q < msg_strings_size; ++q) | |
| 3778 | { | ||
| 3779 | ✗ | MsgStrings[q].clear(); | |
| 3780 | } | ||
| 3781 | } | ||
| 3782 | } | ||
| 3783 | |||
| 3784 | //reset the message strings | ||
| 3785 | ✗ | if(keepdata) | |
| 3786 | { | ||
| 3787 | ✗ | init_msgstrings(0,msg_strings_size); | |
| 3788 | } | ||
| 3789 | |||
| 3790 | ✗ | for(int32_t x=0; x<strings_to_read; x++) | |
| 3791 | { | ||
| 3792 | ✗ | init_msgstr(&tempMsgString); | |
| 3793 | |||
| 3794 | ✗ | if(!pfread(buf,73,f,true)) | |
| 3795 | { | ||
| 3796 | ✗ | return qe_invalid; | |
| 3797 | } | ||
| 3798 | |||
| 3799 | ✗ | buf[74] = '\0'; | |
| 3800 | ✗ | tempMsgString.s = buf; | |
| 3801 | |||
| 3802 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 3803 | { | ||
| 3804 | ✗ | return qe_invalid; | |
| 3805 | } | ||
| 3806 | |||
| 3807 | ✗ | if((Header->zelda_version < 0x192)|| | |
| 3808 | ✗ | ((Header->zelda_version == 0x192)&&(Header->build<148))) | |
| 3809 | { | ||
| 3810 | ✗ | tempMsgString.nextstring=tempbyte?x+1:0; | |
| 3811 | |||
| 3812 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 3813 | { | ||
| 3814 | ✗ | return qe_invalid; | |
| 3815 | } | ||
| 3816 | |||
| 3817 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 3818 | { | ||
| 3819 | ✗ | return qe_invalid; | |
| 3820 | } | ||
| 3821 | } | ||
| 3822 | else | ||
| 3823 | { | ||
| 3824 | ✗ | if(!p_igetw(&tempMsgString.nextstring,f,true)) | |
| 3825 | { | ||
| 3826 | ✗ | return qe_invalid; | |
| 3827 | } | ||
| 3828 | |||
| 3829 | ✗ | if(!pfread(temp_expansion,32,f,true)) | |
| 3830 | { | ||
| 3831 | ✗ | return qe_invalid; | |
| 3832 | } | ||
| 3833 | } | ||
| 3834 | |||
| 3835 | ✗ | if(keepdata==true) | |
| 3836 | { | ||
| 3837 | ✗ | MsgStrings[x] = tempMsgString; | |
| 3838 | } | ||
| 3839 | } | ||
| 3840 | } | ||
| 3841 | else | ||
| 3842 | { | ||
| 3843 | int32_t dummy_int; | ||
| 3844 | word s_version; | ||
| 3845 | word s_cversion; | ||
| 3846 | |||
| 3847 | //section version info | ||
| 3848 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&s_version,f,true)) |
| 3849 | { | ||
| 3850 | ✗ | return qe_invalid; | |
| 3851 | } | ||
| 3852 | |||
| 3853 | 77 | FFCore.quest_format[vStrings] = s_version; | |
| 3854 | |||
| 3855 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&s_cversion,f,true)) |
| 3856 | { | ||
| 3857 | ✗ | return qe_invalid; | |
| 3858 | } | ||
| 3859 | |||
| 3860 | //al_trace("Strings version %d\n", s_version); | ||
| 3861 | //section size | ||
| 3862 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetl(&dummy_int,f,true)) |
| 3863 | { | ||
| 3864 | ✗ | return qe_invalid; | |
| 3865 | } | ||
| 3866 | |||
| 3867 | //finally... section data | ||
| 3868 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&temp_msg_count,f,true)) |
| 3869 | { | ||
| 3870 | ✗ | return qe_invalid; | |
| 3871 | } | ||
| 3872 | |||
| 3873 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(temp_msg_count >= msg_strings_size) |
| 3874 | { | ||
| 3875 | ✗ | Z_message("Reallocating string buffer...\n"); | |
| 3876 | |||
| 3877 | // if((MsgStrings=(MsgStr*)_al_sane_realloc(MsgStrings,sizeof(MsgStr)*MAXMSGS))==NULL) | ||
| 3878 | // return qe_nomem; | ||
| 3879 | ✗ | delete[] MsgStrings; | |
| 3880 | ✗ | MsgStrings = new MsgStr[MAXMSGS]; | |
| 3881 | ✗ | msg_strings_size = MAXMSGS; | |
| 3882 | ✗ | for(auto q = 0; q < msg_strings_size; ++q) | |
| 3883 | { | ||
| 3884 | ✗ | MsgStrings[q].clear(); | |
| 3885 | } | ||
| 3886 | //memset(MsgStrings, 0, sizeof(MsgStr)*MAXMSGS); | ||
| 3887 | } | ||
| 3888 | |||
| 3889 | //reset the message strings | ||
| 3890 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(keepdata) |
| 3891 | { | ||
| 3892 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
|
77 | if(s_version < 7) |
| 3893 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | set_bit(quest_rules,qr_OLD_STRING_EDITOR_MARGINS,true); |
| 3894 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | init_msgstrings(0,msg_strings_size); |
| 3895 | 77 | } | |
| 3896 | |||
| 3897 | 77 | int32_t string_length=(s_version<2)?73:145; | |
| 3898 | |||
| 3899 |
2/2✓ Branch 0 taken 4649 times.
✓ Branch 1 taken 77 times.
|
4726 | for(int32_t i=0; i<temp_msg_count; i++) |
| 3900 | { | ||
| 3901 |
1/2✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
|
4649 | init_msgstr(&tempMsgString); |
| 3902 |
2/2✓ Branch 0 taken 788 times.
✓ Branch 1 taken 3861 times.
|
4649 | if(s_version > 8) |
| 3903 | { | ||
| 3904 |
2/4✓ Branch 0 taken 788 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 788 times.
✗ Branch 3 not taken.
|
788 | if(!p_igetl(&string_length,f,true)) |
| 3905 | { | ||
| 3906 | ✗ | return qe_invalid; | |
| 3907 | } | ||
| 3908 | 788 | } | |
| 3909 |
2/2✓ Branch 0 taken 4511 times.
✓ Branch 1 taken 138 times.
|
4649 | if (string_length > 0) |
| 3910 | { | ||
| 3911 |
2/4✓ Branch 0 taken 4511 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4511 times.
✗ Branch 3 not taken.
|
4511 | if (!pfread(buf, string_length, f, true)) |
| 3912 | { | ||
| 3913 | ✗ | return qe_invalid; | |
| 3914 | } | ||
| 3915 | 4511 | } | |
| 3916 | else | ||
| 3917 | { | ||
| 3918 | 138 | buf[0] = 0; | |
| 3919 | } | ||
| 3920 | |||
| 3921 |
2/4✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4649 times.
✗ Branch 3 not taken.
|
4649 | if(!p_igetw(&tempMsgString.nextstring,f,true)) |
| 3922 | { | ||
| 3923 | ✗ | return qe_invalid; | |
| 3924 | } | ||
| 3925 | |||
| 3926 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4649 times.
|
4649 | if(s_version<2) |
| 3927 | { | ||
| 3928 | ✗ | buf[72] = '\0'; | |
| 3929 | ✗ | tempMsgString.s = buf; | |
| 3930 | } | ||
| 3931 | else | ||
| 3932 | { | ||
| 3933 | // June 2008: A bug corrupted the last 4 chars of a string. | ||
| 3934 | // Discard these. | ||
| 3935 |
1/2✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
|
4649 | if(s_version<3) |
| 3936 | { | ||
| 3937 | ✗ | for(int32_t j=140; j<144; j++) | |
| 3938 | { | ||
| 3939 | ✗ | buf[j] = '\0'; | |
| 3940 | } | ||
| 3941 | } | ||
| 3942 |
1/2✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
|
4649 | if(string_length > 8192) string_length = 8192; |
| 3943 | 4649 | buf[string_length]='\0'; //Force-terminate | |
| 3944 |
1/2✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
|
4649 | tempMsgString.s = buf; |
| 3945 | |||
| 3946 |
2/2✓ Branch 0 taken 788 times.
✓ Branch 1 taken 3861 times.
|
4649 | if ( s_version >= 6 ) |
| 3947 | { | ||
| 3948 |
2/4✓ Branch 0 taken 788 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 788 times.
✗ Branch 3 not taken.
|
788 | if(!p_igetl(&tempMsgString.tile,f,true)) |
| 3949 | { | ||
| 3950 | ✗ | return qe_invalid; | |
| 3951 | } | ||
| 3952 | 788 | } | |
| 3953 | else | ||
| 3954 | { | ||
| 3955 |
2/4✓ Branch 0 taken 3861 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3861 times.
✗ Branch 3 not taken.
|
3861 | if(!p_igetw(&tempMsgString.tile,f,true)) |
| 3956 | { | ||
| 3957 | ✗ | return qe_invalid; | |
| 3958 | } | ||
| 3959 | } | ||
| 3960 | |||
| 3961 |
2/4✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4649 times.
✗ Branch 3 not taken.
|
4649 | if(!p_getc(&tempMsgString.cset,f,true)) |
| 3962 | { | ||
| 3963 | ✗ | return qe_invalid; | |
| 3964 | } | ||
| 3965 | |||
| 3966 | byte dummy_char; | ||
| 3967 | |||
| 3968 |
2/4✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4649 times.
✗ Branch 3 not taken.
|
4649 | if(!p_getc(&dummy_char,f,true)) // trans is stored as a char... |
| 3969 | { | ||
| 3970 | ✗ | return qe_invalid; | |
| 3971 | } | ||
| 3972 | |||
| 3973 | 4649 | tempMsgString.trans=dummy_char!=0; | |
| 3974 | |||
| 3975 |
2/4✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4649 times.
✗ Branch 3 not taken.
|
4649 | if(!p_getc(&tempMsgString.font,f,true)) |
| 3976 | { | ||
| 3977 | ✗ | return qe_invalid; | |
| 3978 | } | ||
| 3979 | |||
| 3980 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4649 times.
|
4649 | if(s_version < 5) |
| 3981 | { | ||
| 3982 | ✗ | if(!p_getc(&tempMsgString.y,f,true)) | |
| 3983 | { | ||
| 3984 | ✗ | return qe_invalid; | |
| 3985 | } | ||
| 3986 | } | ||
| 3987 | else | ||
| 3988 | { | ||
| 3989 |
2/4✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4649 times.
✗ Branch 3 not taken.
|
4649 | if(!p_igetw(&tempMsgString.x,f,true)) |
| 3990 | { | ||
| 3991 | ✗ | return qe_invalid; | |
| 3992 | } | ||
| 3993 | |||
| 3994 |
2/4✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4649 times.
✗ Branch 3 not taken.
|
4649 | if(!p_igetw(&tempMsgString.y,f,true)) |
| 3995 | { | ||
| 3996 | ✗ | return qe_invalid; | |
| 3997 | } | ||
| 3998 | |||
| 3999 |
2/4✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4649 times.
✗ Branch 3 not taken.
|
4649 | if(!p_igetw(&tempMsgString.w,f,true)) |
| 4000 | { | ||
| 4001 | ✗ | return qe_invalid; | |
| 4002 | } | ||
| 4003 | |||
| 4004 |
2/4✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4649 times.
✗ Branch 3 not taken.
|
4649 | if(!p_igetw(&tempMsgString.h,f,true)) |
| 4005 | { | ||
| 4006 | ✗ | return qe_invalid; | |
| 4007 | } | ||
| 4008 | |||
| 4009 |
2/4✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4649 times.
✗ Branch 3 not taken.
|
4649 | if(!p_getc(&tempMsgString.hspace,f,true)) |
| 4010 | { | ||
| 4011 | ✗ | return qe_invalid; | |
| 4012 | } | ||
| 4013 | |||
| 4014 |
2/4✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4649 times.
✗ Branch 3 not taken.
|
4649 | if(!p_getc(&tempMsgString.vspace,f,true)) |
| 4015 | { | ||
| 4016 | ✗ | return qe_invalid; | |
| 4017 | } | ||
| 4018 | |||
| 4019 |
2/4✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4649 times.
✗ Branch 3 not taken.
|
4649 | if(!p_getc(&tempMsgString.stringflags,f,true)) |
| 4020 | { | ||
| 4021 | ✗ | return qe_invalid; | |
| 4022 | } | ||
| 4023 | } | ||
| 4024 | |||
| 4025 |
2/2✓ Branch 0 taken 3861 times.
✓ Branch 1 taken 788 times.
|
4649 | if(s_version >= 7) |
| 4026 | { | ||
| 4027 |
2/2✓ Branch 0 taken 788 times.
✓ Branch 1 taken 3152 times.
|
3940 | for(int32_t q = 0; q < 4; ++q) |
| 4028 | { | ||
| 4029 |
2/4✓ Branch 0 taken 3152 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3152 times.
✗ Branch 3 not taken.
|
3152 | if(!p_getc(&tempMsgString.margins[q],f,true)) |
| 4030 | { | ||
| 4031 | ✗ | return qe_invalid; | |
| 4032 | } | ||
| 4033 | 3152 | } | |
| 4034 | |||
| 4035 |
2/4✓ Branch 0 taken 788 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 788 times.
✗ Branch 3 not taken.
|
788 | if(!p_igetl(&tempMsgString.portrait_tile,f,true)) |
| 4036 | { | ||
| 4037 | ✗ | return qe_invalid; | |
| 4038 | } | ||
| 4039 | |||
| 4040 |
2/4✓ Branch 0 taken 788 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 788 times.
✗ Branch 3 not taken.
|
788 | if(!p_getc(&tempMsgString.portrait_cset,f,true)) |
| 4041 | { | ||
| 4042 | ✗ | return qe_invalid; | |
| 4043 | } | ||
| 4044 | |||
| 4045 |
2/4✓ Branch 0 taken 788 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 788 times.
✗ Branch 3 not taken.
|
788 | if(!p_getc(&tempMsgString.portrait_x,f,true)) |
| 4046 | { | ||
| 4047 | ✗ | return qe_invalid; | |
| 4048 | } | ||
| 4049 | |||
| 4050 |
2/4✓ Branch 0 taken 788 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 788 times.
✗ Branch 3 not taken.
|
788 | if(!p_getc(&tempMsgString.portrait_y,f,true)) |
| 4051 | { | ||
| 4052 | ✗ | return qe_invalid; | |
| 4053 | } | ||
| 4054 | |||
| 4055 |
2/4✓ Branch 0 taken 788 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 788 times.
✗ Branch 3 not taken.
|
788 | if(!p_getc(&tempMsgString.portrait_tw,f,true)) |
| 4056 | { | ||
| 4057 | ✗ | return qe_invalid; | |
| 4058 | } | ||
| 4059 | |||
| 4060 |
2/4✓ Branch 0 taken 788 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 788 times.
✗ Branch 3 not taken.
|
788 | if(!p_getc(&tempMsgString.portrait_th,f,true)) |
| 4061 | { | ||
| 4062 | ✗ | return qe_invalid; | |
| 4063 | } | ||
| 4064 | 788 | } | |
| 4065 | |||
| 4066 |
2/2✓ Branch 0 taken 788 times.
✓ Branch 1 taken 3861 times.
|
4649 | if(s_version >= 8) |
| 4067 | { | ||
| 4068 |
2/4✓ Branch 0 taken 788 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 788 times.
✗ Branch 3 not taken.
|
788 | if(!p_getc(&tempMsgString.shadow_type,f,true)) |
| 4069 | { | ||
| 4070 | ✗ | return qe_invalid; | |
| 4071 | } | ||
| 4072 | |||
| 4073 |
2/4✓ Branch 0 taken 788 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 788 times.
✗ Branch 3 not taken.
|
788 | if(!p_getc(&tempMsgString.shadow_color,f,true)) |
| 4074 | { | ||
| 4075 | ✗ | return qe_invalid; | |
| 4076 | } | ||
| 4077 | 788 | } | |
| 4078 | |||
| 4079 |
2/2✓ Branch 0 taken 713 times.
✓ Branch 1 taken 3936 times.
|
4649 | if(s_version >= 10) |
| 4080 | { | ||
| 4081 |
2/4✓ Branch 0 taken 713 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 713 times.
✗ Branch 3 not taken.
|
713 | if(!p_getc(&tempMsgString.drawlayer,f,true)) |
| 4082 | { | ||
| 4083 | ✗ | return qe_invalid; | |
| 4084 | } | ||
| 4085 | 713 | } | |
| 4086 | |||
| 4087 |
2/4✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4649 times.
✗ Branch 3 not taken.
|
4649 | if(!p_getc(&tempMsgString.sfx,f,true)) |
| 4088 | { | ||
| 4089 | ✗ | return qe_invalid; | |
| 4090 | } | ||
| 4091 | |||
| 4092 |
1/2✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
|
4649 | if(s_version>3) |
| 4093 | { | ||
| 4094 |
2/4✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4649 times.
✗ Branch 3 not taken.
|
4649 | if(!p_igetw(&tempMsgString.listpos,f,true)) |
| 4095 | { | ||
| 4096 | ✗ | return qe_invalid; | |
| 4097 | } | ||
| 4098 | 4649 | } | |
| 4099 | } | ||
| 4100 | |||
| 4101 |
1/2✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
|
4649 | if(keepdata==true) |
| 4102 | { | ||
| 4103 |
1/2✓ Branch 0 taken 4649 times.
✗ Branch 1 not taken.
|
4649 | MsgStrings[i].copyAll(tempMsgString); |
| 4104 | 4649 | } | |
| 4105 | 4649 | } | |
| 4106 | } | ||
| 4107 | |||
| 4108 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata==true) |
| 4109 | { | ||
| 4110 | 77 | msg_count=temp_msg_count; | |
| 4111 | 77 | } | |
| 4112 | |||
| 4113 | 77 | return 0; | |
| 4114 | 77 | } | |
| 4115 | |||
| 4116 | 77 | int32_t readdoorcombosets(PACKFILE *f, zquestheader *Header, bool keepdata) | |
| 4117 | { | ||
| 4118 |
1/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
77 | if((Header->zelda_version < 0x192)|| |
| 4119 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ((Header->zelda_version == 0x192)&&(Header->build<158))) |
| 4120 | { | ||
| 4121 | ✗ | return 0; | |
| 4122 | } | ||
| 4123 | |||
| 4124 | 77 | word temp_door_combo_set_count=0; | |
| 4125 | DoorComboSet tempDoorComboSet; | ||
| 4126 | word dummy_word; | ||
| 4127 | int32_t dummy_long; | ||
| 4128 | byte padding; | ||
| 4129 | 77 | int32_t s_version = 0; | |
| 4130 | |||
| 4131 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata==true) |
| 4132 | { | ||
| 4133 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<MAXDOORCOMBOSETS; i++) |
| 4134 | { | ||
| 4135 | 19712 | memset(DoorComboSets+i, 0, sizeof(DoorComboSet)); | |
| 4136 | 19712 | } | |
| 4137 | 77 | } | |
| 4138 | |||
| 4139 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(Header->zelda_version > 0x192) |
| 4140 | { | ||
| 4141 | //section version info | ||
| 4142 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_version,f,true)) |
| 4143 | { | ||
| 4144 | ✗ | return qe_invalid; | |
| 4145 | } | ||
| 4146 | |||
| 4147 | 77 | FFCore.quest_format[vDoors] = s_version; | |
| 4148 | |||
| 4149 | //al_trace("Door combo sets version %d\n", dummy_word); | ||
| 4150 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&dummy_word,f,true)) |
| 4151 | { | ||
| 4152 | ✗ | return qe_invalid; | |
| 4153 | } | ||
| 4154 | |||
| 4155 | //section size | ||
| 4156 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&dummy_long,f,true)) |
| 4157 | { | ||
| 4158 | ✗ | return qe_invalid; | |
| 4159 | } | ||
| 4160 | 77 | } | |
| 4161 | |||
| 4162 | //finally... section data | ||
| 4163 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&temp_door_combo_set_count,f,true)) |
| 4164 | { | ||
| 4165 | ✗ | return qe_invalid; | |
| 4166 | } | ||
| 4167 | |||
| 4168 |
2/2✓ Branch 0 taken 527 times.
✓ Branch 1 taken 77 times.
|
604 | for(int32_t i=0; i<temp_door_combo_set_count; i++) |
| 4169 | { | ||
| 4170 | 527 | memset(&tempDoorComboSet, 0, sizeof(DoorComboSet)); | |
| 4171 | |||
| 4172 | //name | ||
| 4173 |
1/2✓ Branch 0 taken 527 times.
✗ Branch 1 not taken.
|
527 | if(!pfread(&tempDoorComboSet.name,sizeof(tempDoorComboSet.name),f,true)) |
| 4174 | { | ||
| 4175 | ✗ | return qe_invalid; | |
| 4176 | } | ||
| 4177 | |||
| 4178 |
1/2✓ Branch 0 taken 527 times.
✗ Branch 1 not taken.
|
527 | if(Header->zelda_version < 0x193) |
| 4179 | { | ||
| 4180 | ✗ | if(!p_getc(&padding,f,true)) | |
| 4181 | { | ||
| 4182 | ✗ | return qe_invalid; | |
| 4183 | } | ||
| 4184 | } | ||
| 4185 | |||
| 4186 | //up door | ||
| 4187 |
2/2✓ Branch 0 taken 4743 times.
✓ Branch 1 taken 527 times.
|
5270 | for(int32_t j=0; j<9; j++) |
| 4188 | { | ||
| 4189 |
2/2✓ Branch 0 taken 18972 times.
✓ Branch 1 taken 4743 times.
|
23715 | for(int32_t k=0; k<4; k++) |
| 4190 | { | ||
| 4191 |
1/2✓ Branch 0 taken 18972 times.
✗ Branch 1 not taken.
|
18972 | if(!p_igetw(&tempDoorComboSet.doorcombo_u[j][k],f,true)) |
| 4192 | { | ||
| 4193 | ✗ | return qe_invalid; | |
| 4194 | } | ||
| 4195 | 18972 | } | |
| 4196 | 4743 | } | |
| 4197 | |||
| 4198 |
2/2✓ Branch 0 taken 4743 times.
✓ Branch 1 taken 527 times.
|
5270 | for(int32_t j=0; j<9; j++) |
| 4199 | { | ||
| 4200 |
2/2✓ Branch 0 taken 18972 times.
✓ Branch 1 taken 4743 times.
|
23715 | for(int32_t k=0; k<4; k++) |
| 4201 | { | ||
| 4202 |
1/2✓ Branch 0 taken 18972 times.
✗ Branch 1 not taken.
|
18972 | if(!p_getc(&tempDoorComboSet.doorcset_u[j][k],f,true)) |
| 4203 | { | ||
| 4204 | ✗ | return qe_invalid; | |
| 4205 | } | ||
| 4206 | 18972 | } | |
| 4207 | 4743 | } | |
| 4208 | |||
| 4209 | //down door | ||
| 4210 |
2/2✓ Branch 0 taken 4743 times.
✓ Branch 1 taken 527 times.
|
5270 | for(int32_t j=0; j<9; j++) |
| 4211 | { | ||
| 4212 |
2/2✓ Branch 0 taken 18972 times.
✓ Branch 1 taken 4743 times.
|
23715 | for(int32_t k=0; k<4; k++) |
| 4213 | { | ||
| 4214 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18972 times.
|
18972 | if(!p_igetw(&tempDoorComboSet.doorcombo_d[j][k],f,true)) |
| 4215 | { | ||
| 4216 | ✗ | return qe_invalid; | |
| 4217 | } | ||
| 4218 | 18972 | } | |
| 4219 | 4743 | } | |
| 4220 | |||
| 4221 |
2/2✓ Branch 0 taken 4743 times.
✓ Branch 1 taken 527 times.
|
5270 | for(int32_t j=0; j<9; j++) |
| 4222 | { | ||
| 4223 |
2/2✓ Branch 0 taken 18972 times.
✓ Branch 1 taken 4743 times.
|
23715 | for(int32_t k=0; k<4; k++) |
| 4224 | { | ||
| 4225 |
1/2✓ Branch 0 taken 18972 times.
✗ Branch 1 not taken.
|
18972 | if(!p_getc(&tempDoorComboSet.doorcset_d[j][k],f,true)) |
| 4226 | { | ||
| 4227 | ✗ | return qe_invalid; | |
| 4228 | } | ||
| 4229 | 18972 | } | |
| 4230 | 4743 | } | |
| 4231 | |||
| 4232 | //left door | ||
| 4233 |
2/2✓ Branch 0 taken 4743 times.
✓ Branch 1 taken 527 times.
|
5270 | for(int32_t j=0; j<9; j++) |
| 4234 | { | ||
| 4235 |
2/2✓ Branch 0 taken 28458 times.
✓ Branch 1 taken 4743 times.
|
33201 | for(int32_t k=0; k<6; k++) |
| 4236 | { | ||
| 4237 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28458 times.
|
28458 | if(!p_igetw(&tempDoorComboSet.doorcombo_l[j][k],f,true)) |
| 4238 | { | ||
| 4239 | ✗ | return qe_invalid; | |
| 4240 | } | ||
| 4241 | 28458 | } | |
| 4242 | 4743 | } | |
| 4243 | |||
| 4244 |
2/2✓ Branch 0 taken 4743 times.
✓ Branch 1 taken 527 times.
|
5270 | for(int32_t j=0; j<9; j++) |
| 4245 | { | ||
| 4246 |
2/2✓ Branch 0 taken 28458 times.
✓ Branch 1 taken 4743 times.
|
33201 | for(int32_t k=0; k<6; k++) |
| 4247 | { | ||
| 4248 |
1/2✓ Branch 0 taken 28458 times.
✗ Branch 1 not taken.
|
28458 | if(!p_getc(&tempDoorComboSet.doorcset_l[j][k],f,true)) |
| 4249 | { | ||
| 4250 | ✗ | return qe_invalid; | |
| 4251 | } | ||
| 4252 | 28458 | } | |
| 4253 | 4743 | } | |
| 4254 | |||
| 4255 | //right door | ||
| 4256 |
2/2✓ Branch 0 taken 4743 times.
✓ Branch 1 taken 527 times.
|
5270 | for(int32_t j=0; j<9; j++) |
| 4257 | { | ||
| 4258 |
2/2✓ Branch 0 taken 28458 times.
✓ Branch 1 taken 4743 times.
|
33201 | for(int32_t k=0; k<6; k++) |
| 4259 | { | ||
| 4260 |
1/2✓ Branch 0 taken 28458 times.
✗ Branch 1 not taken.
|
28458 | if(!p_igetw(&tempDoorComboSet.doorcombo_r[j][k],f,true)) |
| 4261 | { | ||
| 4262 | ✗ | return qe_invalid; | |
| 4263 | } | ||
| 4264 | 28458 | } | |
| 4265 | 4743 | } | |
| 4266 | |||
| 4267 |
2/2✓ Branch 0 taken 4743 times.
✓ Branch 1 taken 527 times.
|
5270 | for(int32_t j=0; j<9; j++) |
| 4268 | { | ||
| 4269 |
2/2✓ Branch 0 taken 28458 times.
✓ Branch 1 taken 4743 times.
|
33201 | for(int32_t k=0; k<6; k++) |
| 4270 | { | ||
| 4271 |
1/2✓ Branch 0 taken 28458 times.
✗ Branch 1 not taken.
|
28458 | if(!p_getc(&tempDoorComboSet.doorcset_r[j][k],f,true)) |
| 4272 | { | ||
| 4273 | ✗ | return qe_invalid; | |
| 4274 | } | ||
| 4275 | 28458 | } | |
| 4276 | 4743 | } | |
| 4277 | |||
| 4278 | //up bomb rubble | ||
| 4279 |
2/2✓ Branch 0 taken 1054 times.
✓ Branch 1 taken 527 times.
|
1581 | for(int32_t j=0; j<2; j++) |
| 4280 | { | ||
| 4281 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1054 times.
|
1054 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_u[j],f,true)) |
| 4282 | { | ||
| 4283 | ✗ | return qe_invalid; | |
| 4284 | } | ||
| 4285 | 1054 | } | |
| 4286 | |||
| 4287 |
2/2✓ Branch 0 taken 1054 times.
✓ Branch 1 taken 527 times.
|
1581 | for(int32_t j=0; j<2; j++) |
| 4288 | { | ||
| 4289 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1054 times.
|
1054 | if(!p_getc(&tempDoorComboSet.bombdoorcset_u[j],f,true)) |
| 4290 | { | ||
| 4291 | ✗ | return qe_invalid; | |
| 4292 | } | ||
| 4293 | 1054 | } | |
| 4294 | |||
| 4295 | //down bomb rubble | ||
| 4296 |
2/2✓ Branch 0 taken 1054 times.
✓ Branch 1 taken 527 times.
|
1581 | for(int32_t j=0; j<2; j++) |
| 4297 | { | ||
| 4298 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1054 times.
|
1054 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_d[j],f,true)) |
| 4299 | { | ||
| 4300 | ✗ | return qe_invalid; | |
| 4301 | } | ||
| 4302 | 1054 | } | |
| 4303 | |||
| 4304 |
2/2✓ Branch 0 taken 1054 times.
✓ Branch 1 taken 527 times.
|
1581 | for(int32_t j=0; j<2; j++) |
| 4305 | { | ||
| 4306 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1054 times.
|
1054 | if(!p_getc(&tempDoorComboSet.bombdoorcset_d[j],f,true)) |
| 4307 | { | ||
| 4308 | ✗ | return qe_invalid; | |
| 4309 | } | ||
| 4310 | 1054 | } | |
| 4311 | |||
| 4312 | //left bomb rubble | ||
| 4313 |
2/2✓ Branch 0 taken 1581 times.
✓ Branch 1 taken 527 times.
|
2108 | for(int32_t j=0; j<3; j++) |
| 4314 | { | ||
| 4315 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1581 times.
|
1581 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_l[j],f,true)) |
| 4316 | { | ||
| 4317 | ✗ | return qe_invalid; | |
| 4318 | } | ||
| 4319 | 1581 | } | |
| 4320 | |||
| 4321 |
2/2✓ Branch 0 taken 1581 times.
✓ Branch 1 taken 527 times.
|
2108 | for(int32_t j=0; j<3; j++) |
| 4322 | { | ||
| 4323 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1581 times.
|
1581 | if(!p_getc(&tempDoorComboSet.bombdoorcset_l[j],f,true)) |
| 4324 | { | ||
| 4325 | ✗ | return qe_invalid; | |
| 4326 | } | ||
| 4327 | 1581 | } | |
| 4328 | |||
| 4329 |
1/2✓ Branch 0 taken 527 times.
✗ Branch 1 not taken.
|
527 | if(Header->zelda_version < 0x193) |
| 4330 | { | ||
| 4331 | ✗ | if(!p_getc(&padding,f,true)) | |
| 4332 | { | ||
| 4333 | ✗ | return qe_invalid; | |
| 4334 | } | ||
| 4335 | |||
| 4336 | } | ||
| 4337 | |||
| 4338 | //right bomb rubble | ||
| 4339 |
2/2✓ Branch 0 taken 1581 times.
✓ Branch 1 taken 527 times.
|
2108 | for(int32_t j=0; j<3; j++) |
| 4340 | { | ||
| 4341 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1581 times.
|
1581 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_r[j],f,true)) |
| 4342 | { | ||
| 4343 | ✗ | return qe_invalid; | |
| 4344 | } | ||
| 4345 | 1581 | } | |
| 4346 | |||
| 4347 |
2/2✓ Branch 0 taken 1581 times.
✓ Branch 1 taken 527 times.
|
2108 | for(int32_t j=0; j<3; j++) |
| 4348 | { | ||
| 4349 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1581 times.
|
1581 | if(!p_getc(&tempDoorComboSet.bombdoorcset_r[j],f,true)) |
| 4350 | { | ||
| 4351 | ✗ | return qe_invalid; | |
| 4352 | } | ||
| 4353 | 1581 | } | |
| 4354 | |||
| 4355 |
1/2✓ Branch 0 taken 527 times.
✗ Branch 1 not taken.
|
527 | if(Header->zelda_version < 0x193) |
| 4356 | { | ||
| 4357 | ✗ | if(!p_getc(&padding,f,true)) | |
| 4358 | { | ||
| 4359 | ✗ | return qe_invalid; | |
| 4360 | } | ||
| 4361 | } | ||
| 4362 | |||
| 4363 | //walkthrough stuff | ||
| 4364 |
2/2✓ Branch 0 taken 2108 times.
✓ Branch 1 taken 527 times.
|
2635 | for(int32_t j=0; j<4; j++) |
| 4365 | { | ||
| 4366 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2108 times.
|
2108 | if(!p_igetw(&tempDoorComboSet.walkthroughcombo[j],f,true)) |
| 4367 | { | ||
| 4368 | ✗ | return qe_invalid; | |
| 4369 | } | ||
| 4370 | 2108 | } | |
| 4371 | |||
| 4372 |
2/2✓ Branch 0 taken 2108 times.
✓ Branch 1 taken 527 times.
|
2635 | for(int32_t j=0; j<4; j++) |
| 4373 | { | ||
| 4374 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2108 times.
|
2108 | if(!p_getc(&tempDoorComboSet.walkthroughcset[j],f,true)) |
| 4375 | { | ||
| 4376 | ✗ | return qe_invalid; | |
| 4377 | } | ||
| 4378 | 2108 | } | |
| 4379 | |||
| 4380 | //flags | ||
| 4381 |
2/2✓ Branch 0 taken 1054 times.
✓ Branch 1 taken 527 times.
|
1581 | for(int32_t j=0; j<2; j++) |
| 4382 | { | ||
| 4383 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1054 times.
|
1054 | if(!p_getc(&tempDoorComboSet.flags[j],f,true)) |
| 4384 | { | ||
| 4385 | ✗ | return qe_invalid; | |
| 4386 | } | ||
| 4387 | 1054 | } | |
| 4388 | |||
| 4389 |
1/2✓ Branch 0 taken 527 times.
✗ Branch 1 not taken.
|
527 | if(Header->zelda_version < 0x193) |
| 4390 | { | ||
| 4391 | ✗ | if(!pfread(&tempDoorComboSet.expansion,sizeof(tempDoorComboSet.expansion),f,true)) | |
| 4392 | { | ||
| 4393 | ✗ | return qe_invalid; | |
| 4394 | } | ||
| 4395 | } | ||
| 4396 | |||
| 4397 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 527 times.
|
527 | if(keepdata==true) |
| 4398 | { | ||
| 4399 | 527 | memcpy(&DoorComboSets[i], &tempDoorComboSet, sizeof(tempDoorComboSet)); | |
| 4400 | 527 | } | |
| 4401 | 527 | } | |
| 4402 | |||
| 4403 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata==true) |
| 4404 | { | ||
| 4405 | 77 | door_combo_set_count=temp_door_combo_set_count; | |
| 4406 | 77 | } | |
| 4407 | |||
| 4408 | 77 | return 0; | |
| 4409 | 77 | } | |
| 4410 | |||
| 4411 | ✗ | int32_t count_dmaps() | |
| 4412 | { | ||
| 4413 | ✗ | int32_t i=MAXDMAPS-1; | |
| 4414 | ✗ | bool found=false; | |
| 4415 | |||
| 4416 | ✗ | while(i>=0 && !found) | |
| 4417 | { | ||
| 4418 | ✗ | if((DMaps[i].map!=0)||(DMaps[i].level!=0)||(DMaps[i].xoff!=0)|| | |
| 4419 | ✗ | (DMaps[i].compass!=0)||(DMaps[i].color!=0)||(DMaps[i].midi!=0)|| | |
| 4420 | ✗ | (DMaps[i].cont!=0)||(DMaps[i].type!=0)) | |
| 4421 | ✗ | found=true; | |
| 4422 | |||
| 4423 | ✗ | for(int32_t j=0; j<8; j++) | |
| 4424 | { | ||
| 4425 | ✗ | if(DMaps[i].grid[j]!=0) | |
| 4426 | |||
| 4427 | ✗ | found=true; | |
| 4428 | } | ||
| 4429 | |||
| 4430 | ✗ | if((DMaps[i].name[0]!=0)||(DMaps[i].title[0]!=0)|| | |
| 4431 | ✗ | (DMaps[i].intro[0]!=0)||(DMaps[i].tmusic[0]!=0)) | |
| 4432 | ✗ | found=true; | |
| 4433 | |||
| 4434 | ✗ | if((DMaps[i].minimap_1_tile!=0)||(DMaps[i].minimap_2_tile!=0)|| | |
| 4435 | ✗ | (DMaps[i].largemap_1_tile!=0)||(DMaps[i].largemap_2_tile!=0)|| | |
| 4436 | ✗ | (DMaps[i].minimap_1_cset!=0)||(DMaps[i].minimap_2_cset!=0)|| | |
| 4437 | ✗ | (DMaps[i].largemap_1_cset!=0)||(DMaps[i].largemap_2_cset!=0)) | |
| 4438 | ✗ | found=true; | |
| 4439 | |||
| 4440 | ✗ | if(!found) | |
| 4441 | { | ||
| 4442 | ✗ | i--; | |
| 4443 | } | ||
| 4444 | } | ||
| 4445 | |||
| 4446 | ✗ | return i+1; | |
| 4447 | } | ||
| 4448 | |||
| 4449 | |||
| 4450 | ✗ | int32_t count_shops(miscQdata *Misc) | |
| 4451 | { | ||
| 4452 | ✗ | int32_t i=255,j; | |
| 4453 | ✗ | bool found=false; | |
| 4454 | |||
| 4455 | ✗ | while(i>=0 && !found) | |
| 4456 | { | ||
| 4457 | ✗ | j=2; | |
| 4458 | |||
| 4459 | ✗ | while(j>=0 && !found) | |
| 4460 | { | ||
| 4461 | ✗ | if((Misc->shop[i].hasitem[j]!=0)||(Misc->shop[i].price[j]!=0)) | |
| 4462 | { | ||
| 4463 | ✗ | found=true; | |
| 4464 | } | ||
| 4465 | else | ||
| 4466 | { | ||
| 4467 | ✗ | j--; | |
| 4468 | } | ||
| 4469 | } | ||
| 4470 | |||
| 4471 | ✗ | if(Misc->shop[i].name[0]!=0) | |
| 4472 | { | ||
| 4473 | ✗ | found=true; | |
| 4474 | } | ||
| 4475 | |||
| 4476 | ✗ | if(!found) | |
| 4477 | { | ||
| 4478 | ✗ | i--; | |
| 4479 | } | ||
| 4480 | } | ||
| 4481 | |||
| 4482 | ✗ | return i+1; | |
| 4483 | } | ||
| 4484 | |||
| 4485 | ✗ | int32_t count_infos(miscQdata *Misc) | |
| 4486 | { | ||
| 4487 | ✗ | int32_t i=255,j; | |
| 4488 | ✗ | bool found=false; | |
| 4489 | |||
| 4490 | ✗ | while(i>=0 && !found) | |
| 4491 | { | ||
| 4492 | ✗ | j=2; | |
| 4493 | |||
| 4494 | ✗ | while(j>=0 && !found) | |
| 4495 | { | ||
| 4496 | ✗ | if((Misc->info[i].str[j]!=0)||(Misc->info[i].price[j]!=0)) | |
| 4497 | { | ||
| 4498 | ✗ | found=true; | |
| 4499 | } | ||
| 4500 | else | ||
| 4501 | { | ||
| 4502 | ✗ | j--; | |
| 4503 | } | ||
| 4504 | } | ||
| 4505 | |||
| 4506 | ✗ | if(Misc->info[i].name[0]!=0) | |
| 4507 | { | ||
| 4508 | ✗ | found=true; | |
| 4509 | } | ||
| 4510 | |||
| 4511 | ✗ | if(!found) | |
| 4512 | { | ||
| 4513 | ✗ | i--; | |
| 4514 | } | ||
| 4515 | } | ||
| 4516 | |||
| 4517 | ✗ | return i+1; | |
| 4518 | } | ||
| 4519 | |||
| 4520 | ✗ | int32_t count_warprings(miscQdata *Misc) | |
| 4521 | { | ||
| 4522 | ✗ | int32_t i=15,j; | |
| 4523 | ✗ | bool found=false; | |
| 4524 | |||
| 4525 | ✗ | while(i>=0 && !found) | |
| 4526 | { | ||
| 4527 | ✗ | j=7; | |
| 4528 | |||
| 4529 | ✗ | while(j>=0 && !found) | |
| 4530 | { | ||
| 4531 | ✗ | if((Misc->warp[i].dmap[j]!=0)||(Misc->warp[i].scr[j]!=0)) | |
| 4532 | { | ||
| 4533 | ✗ | found=true; | |
| 4534 | } | ||
| 4535 | else | ||
| 4536 | { | ||
| 4537 | ✗ | j--; | |
| 4538 | } | ||
| 4539 | } | ||
| 4540 | |||
| 4541 | ✗ | if(!found) | |
| 4542 | { | ||
| 4543 | ✗ | i--; | |
| 4544 | } | ||
| 4545 | } | ||
| 4546 | |||
| 4547 | ✗ | return i+1; | |
| 4548 | } | ||
| 4549 | |||
| 4550 | ✗ | int32_t count_palcycles(miscQdata *Misc) | |
| 4551 | { | ||
| 4552 | ✗ | int32_t i=255,j; | |
| 4553 | ✗ | bool found=false; | |
| 4554 | |||
| 4555 | ✗ | while(i>=0 && !found) | |
| 4556 | { | ||
| 4557 | ✗ | j=2; | |
| 4558 | |||
| 4559 | ✗ | while(j>=0 && !found) | |
| 4560 | { | ||
| 4561 | ✗ | if(Misc->cycles[i][j].count!=0) | |
| 4562 | { | ||
| 4563 | ✗ | found=true; | |
| 4564 | } | ||
| 4565 | else | ||
| 4566 | { | ||
| 4567 | ✗ | j--; | |
| 4568 | } | ||
| 4569 | } | ||
| 4570 | |||
| 4571 | ✗ | if(!found) | |
| 4572 | { | ||
| 4573 | ✗ | i--; | |
| 4574 | } | ||
| 4575 | } | ||
| 4576 | |||
| 4577 | ✗ | return i+1; | |
| 4578 | } | ||
| 4579 | |||
| 4580 | 126557 | void clear_screen(mapscr *temp_scr) | |
| 4581 | { | ||
| 4582 | 126557 | temp_scr->zero_memory(); | |
| 4583 | 126557 | } | |
| 4584 | |||
| 4585 | 77 | int32_t readdmaps(PACKFILE *f, zquestheader *Header, word, word, word start_dmap, word max_dmaps, bool keepdata) | |
| 4586 | { | ||
| 4587 | 77 | word dmapstoread=0; | |
| 4588 | dmap tempDMap; | ||
| 4589 | |||
| 4590 | int32_t dummy; | ||
| 4591 | 77 | word s_version=0, s_cversion=0; | |
| 4592 | byte padding; | ||
| 4593 | |||
| 4594 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata==true) |
| 4595 | { | ||
| 4596 |
2/2✓ Branch 0 taken 39424 times.
✓ Branch 1 taken 77 times.
|
39501 | for(int32_t i=0; i<max_dmaps; i++) |
| 4597 | { | ||
| 4598 | 39424 | memset(&DMaps[start_dmap+i],0,sizeof(dmap)); | |
| 4599 | 39424 | sprintf(DMaps[start_dmap+i].title," "); | |
| 4600 | 39424 | sprintf(DMaps[start_dmap+i].intro," "); | |
| 4601 | 39424 | DMaps[start_dmap+i].type |= dmCAVE; | |
| 4602 | 39424 | } | |
| 4603 | 77 | } | |
| 4604 | |||
| 4605 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!Header || Header->zelda_version > 0x192) |
| 4606 | { | ||
| 4607 | //section version info | ||
| 4608 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_version,f,true)) |
| 4609 | { | ||
| 4610 | ✗ | return qe_invalid; | |
| 4611 | } | ||
| 4612 | |||
| 4613 | 77 | FFCore.quest_format[vDMaps] = s_version; | |
| 4614 | |||
| 4615 | //al_trace("DMaps version %d\n", s_version); | ||
| 4616 | |||
| 4617 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_cversion,f,true)) |
| 4618 | { | ||
| 4619 | ✗ | return qe_invalid; | |
| 4620 | } | ||
| 4621 | |||
| 4622 | //section size | ||
| 4623 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&dummy,f,true)) |
| 4624 | { | ||
| 4625 | ✗ | return qe_invalid; | |
| 4626 | } | ||
| 4627 | |||
| 4628 | //finally... section data | ||
| 4629 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&dmapstoread,f,true)) |
| 4630 | { | ||
| 4631 | ✗ | return qe_invalid; | |
| 4632 | } | ||
| 4633 | 77 | } | |
| 4634 | else | ||
| 4635 | { | ||
| 4636 | ✗ | if((Header->zelda_version < 0x192)|| | |
| 4637 | ✗ | ((Header->zelda_version == 0x192)&&(Header->build<5))) | |
| 4638 | { | ||
| 4639 | ✗ | dmapstoread=32; | |
| 4640 | } | ||
| 4641 | ✗ | else if(s_version <= 4) | |
| 4642 | { | ||
| 4643 | ✗ | dmapstoread=OLDMAXDMAPS; | |
| 4644 | } | ||
| 4645 | else | ||
| 4646 | { | ||
| 4647 | ✗ | dmapstoread=MAXDMAPS; | |
| 4648 | } | ||
| 4649 | } | ||
| 4650 | |||
| 4651 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | dmapstoread=zc_min(dmapstoread, max_dmaps); |
| 4652 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | dmapstoread=zc_min(dmapstoread, MAXDMAPS-start_dmap); |
| 4653 | |||
| 4654 |
2/2✓ Branch 0 taken 39424 times.
✓ Branch 1 taken 77 times.
|
39501 | for(int32_t i=start_dmap; i<dmapstoread+start_dmap; i++) |
| 4655 | { | ||
| 4656 | 39424 | memset(&tempDMap,0,sizeof(dmap)); | |
| 4657 | 39424 | sprintf(tempDMap.title," "); | |
| 4658 | 39424 | sprintf(tempDMap.intro," "); | |
| 4659 | |||
| 4660 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&tempDMap.map,f,keepdata)) |
| 4661 | { | ||
| 4662 | ✗ | return qe_invalid; | |
| 4663 | } | ||
| 4664 | |||
| 4665 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 39424 times.
|
39424 | if(s_version <= 4) |
| 4666 | { | ||
| 4667 | byte tempbyte; | ||
| 4668 | |||
| 4669 | ✗ | if(!p_getc(&tempbyte,f,keepdata)) | |
| 4670 | { | ||
| 4671 | ✗ | return qe_invalid; | |
| 4672 | } | ||
| 4673 | |||
| 4674 | ✗ | tempDMap.level=(word)tempbyte; | |
| 4675 | } | ||
| 4676 | else | ||
| 4677 | { | ||
| 4678 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&tempDMap.level,f,keepdata)) |
| 4679 | { | ||
| 4680 | ✗ | return qe_invalid; | |
| 4681 | } | ||
| 4682 | } | ||
| 4683 | |||
| 4684 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&tempDMap.xoff,f,keepdata)) |
| 4685 | { | ||
| 4686 | ✗ | return qe_invalid; | |
| 4687 | } | ||
| 4688 | |||
| 4689 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&tempDMap.compass,f,keepdata)) |
| 4690 | { | ||
| 4691 | ✗ | return qe_invalid; | |
| 4692 | } | ||
| 4693 | |||
| 4694 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(s_version > 8) // February 2009 |
| 4695 | { | ||
| 4696 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&tempDMap.color,f,true)) |
| 4697 | { | ||
| 4698 | ✗ | return qe_invalid; | |
| 4699 | } | ||
| 4700 | 39424 | } | |
| 4701 | else | ||
| 4702 | { | ||
| 4703 | byte tempbyte; | ||
| 4704 | |||
| 4705 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 4706 | { | ||
| 4707 | ✗ | return qe_invalid; | |
| 4708 | } | ||
| 4709 | |||
| 4710 | ✗ | tempDMap.color = (word)tempbyte; | |
| 4711 | } | ||
| 4712 | |||
| 4713 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&tempDMap.midi,f,keepdata)) |
| 4714 | { | ||
| 4715 | ✗ | return qe_invalid; | |
| 4716 | } | ||
| 4717 | |||
| 4718 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&tempDMap.cont,f,keepdata)) |
| 4719 | { | ||
| 4720 | ✗ | return qe_invalid; | |
| 4721 | } | ||
| 4722 | |||
| 4723 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&tempDMap.type,f,keepdata)) |
| 4724 | { | ||
| 4725 | ✗ | return qe_invalid; | |
| 4726 | } | ||
| 4727 | |||
| 4728 |
3/4✓ Branch 0 taken 265 times.
✓ Branch 1 taken 39159 times.
✓ Branch 2 taken 265 times.
✗ Branch 3 not taken.
|
39689 | if((tempDMap.type & dmfTYPE) == dmOVERW && |
| 4729 |
1/2✓ Branch 0 taken 265 times.
✗ Branch 1 not taken.
|
265 | (!Header || Header->zelda_version >= 0x210)) // Not sure exactly when this changed |
| 4730 | 265 | tempDMap.xoff = 0; | |
| 4731 | |||
| 4732 |
2/2✓ Branch 0 taken 315392 times.
✓ Branch 1 taken 39424 times.
|
354816 | for(int32_t j=0; j<8; j++) |
| 4733 | { | ||
| 4734 |
1/2✓ Branch 0 taken 315392 times.
✗ Branch 1 not taken.
|
315392 | if(!p_getc(&tempDMap.grid[j],f,keepdata)) |
| 4735 | { | ||
| 4736 | ✗ | return qe_invalid; | |
| 4737 | } | ||
| 4738 | 315392 | } | |
| 4739 | |||
| 4740 |
3/8✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 39424 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 39424 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
39424 | if(Header && ((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<41)))) |
| 4741 | { | ||
| 4742 | ✗ | if(tempDMap.level>0&&tempDMap.level<10) | |
| 4743 | { | ||
| 4744 | ✗ | sprintf(tempDMap.title,"LEVEL-%d ", tempDMap.level); | |
| 4745 | } | ||
| 4746 | |||
| 4747 | ✗ | if(i==0 && Header->zelda_version <= 0x190) | |
| 4748 | { | ||
| 4749 | ✗ | tempDMap.cont-=tempDMap.xoff; | |
| 4750 | ✗ | tempDMap.compass-=tempDMap.xoff; | |
| 4751 | } | ||
| 4752 | |||
| 4753 | //forgotten -DD | ||
| 4754 | ✗ | if(tempDMap.level==0) | |
| 4755 | { | ||
| 4756 | ✗ | tempDMap.flags=dmfCAVES|dmf3STAIR|dmfWHIRLWIND|dmfGUYCAVES; | |
| 4757 | } | ||
| 4758 | } | ||
| 4759 | else | ||
| 4760 | { | ||
| 4761 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!pfread(&tempDMap.name,sizeof(DMaps[0].name),f,true)) |
| 4762 | { | ||
| 4763 | ✗ | return qe_invalid; | |
| 4764 | } | ||
| 4765 | |||
| 4766 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!pfread(&tempDMap.title,sizeof(DMaps[0].title),f,true)) |
| 4767 | { | ||
| 4768 | ✗ | return qe_invalid; | |
| 4769 | } | ||
| 4770 | |||
| 4771 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!pfread(&tempDMap.intro,sizeof(DMaps[0].intro),f,true)) |
| 4772 | { | ||
| 4773 | ✗ | return qe_invalid; | |
| 4774 | } | ||
| 4775 | |||
| 4776 |
3/8✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 39424 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 39424 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
39424 | if(Header && ((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<152)))) |
| 4777 | { | ||
| 4778 | ✗ | if ((tempDMap.type & dmfTYPE) == dmOVERW) tempDMap.flags = dmfCAVES | dmf3STAIR | dmfWHIRLWIND | dmfGUYCAVES; | |
| 4779 | ✗ | if(keepdata==true) | |
| 4780 | { | ||
| 4781 | ✗ | memcpy(&DMaps[i], &tempDMap, sizeof(tempDMap)); | |
| 4782 | } | ||
| 4783 | |||
| 4784 | ✗ | continue; | |
| 4785 | } | ||
| 4786 | |||
| 4787 |
2/4✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 39424 times.
✗ Branch 3 not taken.
|
39424 | if(Header && (Header->zelda_version < 0x193)) |
| 4788 | { | ||
| 4789 | ✗ | if(!p_getc(&padding,f,keepdata)) | |
| 4790 | { | ||
| 4791 | ✗ | return qe_invalid; | |
| 4792 | } | ||
| 4793 | } | ||
| 4794 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if ( s_version >= 11 ) |
| 4795 | { | ||
| 4796 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&tempDMap.minimap_1_tile,f,keepdata)) |
| 4797 | { | ||
| 4798 | ✗ | return qe_invalid; | |
| 4799 | } | ||
| 4800 | 4096 | } | |
| 4801 | else | ||
| 4802 | { | ||
| 4803 |
1/2✓ Branch 0 taken 35328 times.
✗ Branch 1 not taken.
|
35328 | if(!p_igetw(&tempDMap.minimap_1_tile,f,keepdata)) |
| 4804 | { | ||
| 4805 | ✗ | return qe_invalid; | |
| 4806 | } | ||
| 4807 | } | ||
| 4808 | |||
| 4809 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&tempDMap.minimap_1_cset,f,keepdata)) |
| 4810 | { | ||
| 4811 | ✗ | return qe_invalid; | |
| 4812 | } | ||
| 4813 | |||
| 4814 |
2/4✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 39424 times.
✗ Branch 3 not taken.
|
39424 | if(Header && (Header->zelda_version < 0x193)) |
| 4815 | { | ||
| 4816 | ✗ | if(!p_getc(&padding,f,keepdata)) | |
| 4817 | { | ||
| 4818 | ✗ | return qe_invalid; | |
| 4819 | } | ||
| 4820 | } | ||
| 4821 | |||
| 4822 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if ( s_version >= 11 ) |
| 4823 | { | ||
| 4824 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&tempDMap.minimap_2_tile,f,keepdata)) |
| 4825 | { | ||
| 4826 | ✗ | return qe_invalid; | |
| 4827 | } | ||
| 4828 | 4096 | } | |
| 4829 | else | ||
| 4830 | { | ||
| 4831 |
1/2✓ Branch 0 taken 35328 times.
✗ Branch 1 not taken.
|
35328 | if(!p_igetw(&tempDMap.minimap_2_tile,f,keepdata)) |
| 4832 | { | ||
| 4833 | ✗ | return qe_invalid; | |
| 4834 | } | ||
| 4835 | } | ||
| 4836 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&tempDMap.minimap_2_cset,f,keepdata)) |
| 4837 | { | ||
| 4838 | ✗ | return qe_invalid; | |
| 4839 | } | ||
| 4840 | |||
| 4841 |
2/4✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 39424 times.
✗ Branch 3 not taken.
|
39424 | if(Header && (Header->zelda_version < 0x193)) |
| 4842 | { | ||
| 4843 | ✗ | if(!p_getc(&padding,f,keepdata)) | |
| 4844 | { | ||
| 4845 | ✗ | return qe_invalid; | |
| 4846 | } | ||
| 4847 | } | ||
| 4848 | |||
| 4849 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if ( s_version >= 11 ) |
| 4850 | { | ||
| 4851 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&tempDMap.largemap_1_tile,f,keepdata)) |
| 4852 | { | ||
| 4853 | ✗ | return qe_invalid; | |
| 4854 | } | ||
| 4855 | 4096 | } | |
| 4856 | else | ||
| 4857 | { | ||
| 4858 |
1/2✓ Branch 0 taken 35328 times.
✗ Branch 1 not taken.
|
35328 | if(!p_igetw(&tempDMap.largemap_1_tile,f,keepdata)) |
| 4859 | { | ||
| 4860 | ✗ | return qe_invalid; | |
| 4861 | } | ||
| 4862 | } | ||
| 4863 | |||
| 4864 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&tempDMap.largemap_1_cset,f,keepdata)) |
| 4865 | { | ||
| 4866 | ✗ | return qe_invalid; | |
| 4867 | } | ||
| 4868 | |||
| 4869 |
2/4✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 39424 times.
✗ Branch 3 not taken.
|
39424 | if(Header && (Header->zelda_version < 0x193)) |
| 4870 | { | ||
| 4871 | |||
| 4872 | ✗ | if(!p_getc(&padding,f,keepdata)) | |
| 4873 | { | ||
| 4874 | ✗ | return qe_invalid; | |
| 4875 | } | ||
| 4876 | } | ||
| 4877 | |||
| 4878 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if ( s_version >= 11 ) |
| 4879 | { | ||
| 4880 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&tempDMap.largemap_2_tile,f,keepdata)) |
| 4881 | { | ||
| 4882 | ✗ | return qe_invalid; | |
| 4883 | } | ||
| 4884 | 4096 | } | |
| 4885 | else | ||
| 4886 | { | ||
| 4887 |
1/2✓ Branch 0 taken 35328 times.
✗ Branch 1 not taken.
|
35328 | if(!p_igetw(&tempDMap.largemap_2_tile,f,keepdata)) |
| 4888 | { | ||
| 4889 | ✗ | return qe_invalid; | |
| 4890 | } | ||
| 4891 | } | ||
| 4892 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&tempDMap.largemap_2_cset,f,keepdata)) |
| 4893 | { | ||
| 4894 | ✗ | return qe_invalid; | |
| 4895 | } | ||
| 4896 | |||
| 4897 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!pfread(&tempDMap.tmusic,sizeof(DMaps[0].tmusic),f,true)) |
| 4898 | { | ||
| 4899 | ✗ | return qe_invalid; | |
| 4900 | } | ||
| 4901 | } | ||
| 4902 | |||
| 4903 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 39424 times.
|
39424 | if(s_version>1) |
| 4904 | { | ||
| 4905 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&tempDMap.tmusictrack,f,keepdata)) |
| 4906 | { | ||
| 4907 | ✗ | return qe_invalid; | |
| 4908 | } | ||
| 4909 | |||
| 4910 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&tempDMap.active_subscreen,f,keepdata)) |
| 4911 | { | ||
| 4912 | ✗ | return qe_invalid; | |
| 4913 | } | ||
| 4914 | |||
| 4915 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&tempDMap.passive_subscreen,f,keepdata)) |
| 4916 | { | ||
| 4917 | ✗ | return qe_invalid; | |
| 4918 | } | ||
| 4919 | 39424 | } | |
| 4920 | |||
| 4921 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 39424 times.
|
39424 | if(s_version>2) |
| 4922 | { | ||
| 4923 | byte di[32]; | ||
| 4924 | |||
| 4925 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!pfread(&di, 32, f, true)) return qe_invalid; |
| 4926 | |||
| 4927 |
2/2✓ Branch 0 taken 10092544 times.
✓ Branch 1 taken 39424 times.
|
10131968 | for(int32_t j=0; j<MAXITEMS; j++) |
| 4928 | { | ||
| 4929 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10092544 times.
|
10092544 | if(di[j/8] & (1 << (j%8))) tempDMap.disableditems[j]=1; |
| 4930 | 10092544 | else tempDMap.disableditems[j]=0; | |
| 4931 | 10092544 | } | |
| 4932 | 39424 | } | |
| 4933 | |||
| 4934 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(s_version >= 6) |
| 4935 | { | ||
| 4936 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetl(&tempDMap.flags,f,keepdata)) |
| 4937 | { | ||
| 4938 | ✗ | return qe_invalid; | |
| 4939 | } | ||
| 4940 | 39424 | } | |
| 4941 | ✗ | else if(s_version>3) | |
| 4942 | { | ||
| 4943 | char temp; | ||
| 4944 | |||
| 4945 | ✗ | if(!p_getc(&temp,f,keepdata)) | |
| 4946 | { | ||
| 4947 | ✗ | return qe_invalid; | |
| 4948 | } | ||
| 4949 | |||
| 4950 | ✗ | tempDMap.flags = temp; | |
| 4951 | } | ||
| 4952 | ✗ | else if(tempDMap.level==0 && ((Header->zelda_version < 0x211) || ((Header->zelda_version == 0x211) && (Header->build<18)))) | |
| 4953 | { | ||
| 4954 | ✗ | tempDMap.flags=dmfCAVES|dmf3STAIR|dmfWHIRLWIND|dmfGUYCAVES; | |
| 4955 | } | ||
| 4956 | else | ||
| 4957 | ✗ | tempDMap.flags=0; | |
| 4958 | |||
| 4959 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(s_version<7) |
| 4960 | { | ||
| 4961 | ✗ | if(tempDMap.level==0 && get_bit(deprecated_rules,14)) | |
| 4962 | ✗ | tempDMap.flags|= dmfVIEWMAP; | |
| 4963 | } | ||
| 4964 | |||
| 4965 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(s_version<8) |
| 4966 | { | ||
| 4967 | ✗ | if(tempDMap.level==0 && (tempDMap.type&dmfTYPE)==dmDNGN) | |
| 4968 | { | ||
| 4969 | ✗ | tempDMap.type &= ~dmDNGN; | |
| 4970 | ✗ | tempDMap.type |= dmCAVE; | |
| 4971 | } | ||
| 4972 | ✗ | else if((tempDMap.type&dmfTYPE)==dmCAVE) | |
| 4973 | { | ||
| 4974 | ✗ | tempDMap.flags |= dmfMINIMAPCOLORFIX; | |
| 4975 | } | ||
| 4976 | } | ||
| 4977 | |||
| 4978 |
3/8✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 39424 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 39424 times.
✗ Branch 7 not taken.
|
39424 | if(Header && ((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>=41))) |
| 4979 | 39424 | && (Header->zelda_version < 0x193)) | |
| 4980 | { | ||
| 4981 | ✗ | if(!p_getc(&padding,f,keepdata)) | |
| 4982 | { | ||
| 4983 | ✗ | return qe_invalid; | |
| 4984 | } | ||
| 4985 | } | ||
| 4986 | |||
| 4987 |
2/2✓ Branch 0 taken 35328 times.
✓ Branch 1 taken 4096 times.
|
39424 | if(s_version >= 10) |
| 4988 | { | ||
| 4989 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_getc(&tempDMap.sideview,f,keepdata)) |
| 4990 | { | ||
| 4991 | ✗ | return qe_invalid; | |
| 4992 | } | ||
| 4993 | 4096 | } | |
| 4994 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if(s_version < 10) tempDMap.sideview = 0; |
| 4995 | |||
| 4996 | //Dmap Scripts | ||
| 4997 |
2/2✓ Branch 0 taken 35328 times.
✓ Branch 1 taken 4096 times.
|
39424 | if(s_version >= 12) |
| 4998 | { | ||
| 4999 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetw(&tempDMap.script,f,keepdata)) |
| 5000 | { | ||
| 5001 | ✗ | return qe_invalid; | |
| 5002 | } | ||
| 5003 |
2/2✓ Branch 0 taken 32768 times.
✓ Branch 1 taken 4096 times.
|
36864 | for ( int32_t q = 0; q < 8; q++ ) |
| 5004 | { | ||
| 5005 |
1/2✓ Branch 0 taken 32768 times.
✗ Branch 1 not taken.
|
32768 | if(!p_igetl(&tempDMap.initD[q],f,keepdata)) |
| 5006 | { | ||
| 5007 | ✗ | return qe_invalid; | |
| 5008 | } | ||
| 5009 | 32768 | } | |
| 5010 | 4096 | } | |
| 5011 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if ( s_version < 12 ) |
| 5012 | { | ||
| 5013 | 35328 | tempDMap.script = 0; | |
| 5014 |
2/2✓ Branch 0 taken 282624 times.
✓ Branch 1 taken 35328 times.
|
317952 | for ( int32_t q = 0; q < 8; q++ ) |
| 5015 | { | ||
| 5016 | 282624 | tempDMap.initD[q] = 0; | |
| 5017 | 282624 | } | |
| 5018 | 35328 | } | |
| 5019 | |||
| 5020 |
2/2✓ Branch 0 taken 35328 times.
✓ Branch 1 taken 4096 times.
|
39424 | if(s_version >= 13) |
| 5021 | { | ||
| 5022 |
2/2✓ Branch 0 taken 32768 times.
✓ Branch 1 taken 4096 times.
|
36864 | for ( int32_t q = 0; q < 8; q++ ) |
| 5023 | { | ||
| 5024 |
2/2✓ Branch 0 taken 2129920 times.
✓ Branch 1 taken 32768 times.
|
2162688 | for ( int32_t w = 0; w < 65; w++ ) |
| 5025 | { | ||
| 5026 |
1/2✓ Branch 0 taken 2129920 times.
✗ Branch 1 not taken.
|
2129920 | if(!p_getc(&tempDMap.initD_label[q][w],f,keepdata)) |
| 5027 | { | ||
| 5028 | ✗ | return qe_invalid; | |
| 5029 | } | ||
| 5030 | 2129920 | } | |
| 5031 | 32768 | } | |
| 5032 | 4096 | } | |
| 5033 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if ( s_version < 13 ) |
| 5034 | { | ||
| 5035 | 35328 | tempDMap.script = 0; | |
| 5036 |
2/2✓ Branch 0 taken 282624 times.
✓ Branch 1 taken 35328 times.
|
317952 | for ( int32_t q = 0; q < 8; q++ ) |
| 5037 | { | ||
| 5038 |
2/2✓ Branch 0 taken 18370560 times.
✓ Branch 1 taken 282624 times.
|
18653184 | for ( int32_t w = 0; w < 65; w++ ) |
| 5039 | 18370560 | tempDMap.initD_label[q][w] = 0; | |
| 5040 | 282624 | } | |
| 5041 | 35328 | } | |
| 5042 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if(s_version >= 14) |
| 5043 | { | ||
| 5044 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetw(&tempDMap.active_sub_script,f,keepdata)) |
| 5045 | { | ||
| 5046 | ✗ | return qe_invalid; | |
| 5047 | } | ||
| 5048 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetw(&tempDMap.passive_sub_script,f,keepdata)) |
| 5049 | { | ||
| 5050 | ✗ | return qe_invalid; | |
| 5051 | } | ||
| 5052 |
2/2✓ Branch 0 taken 32768 times.
✓ Branch 1 taken 4096 times.
|
36864 | for ( int32_t q = 0; q < 8; ++q ) |
| 5053 | { | ||
| 5054 |
1/2✓ Branch 0 taken 32768 times.
✗ Branch 1 not taken.
|
32768 | if(!p_igetl(&tempDMap.sub_initD[q],f,keepdata)) |
| 5055 | { | ||
| 5056 | ✗ | return qe_invalid; | |
| 5057 | } | ||
| 5058 | 32768 | } | |
| 5059 |
2/2✓ Branch 0 taken 32768 times.
✓ Branch 1 taken 4096 times.
|
36864 | for(int32_t q = 0; q < 8; ++q) |
| 5060 | { | ||
| 5061 |
2/2✓ Branch 0 taken 2129920 times.
✓ Branch 1 taken 32768 times.
|
2162688 | for ( int32_t w = 0; w < 65; ++w ) |
| 5062 | { | ||
| 5063 |
1/2✓ Branch 0 taken 2129920 times.
✗ Branch 1 not taken.
|
2129920 | if(!p_getc(&tempDMap.sub_initD_label[q][w],f,keepdata)) |
| 5064 | { | ||
| 5065 | ✗ | return qe_invalid; | |
| 5066 | } | ||
| 5067 | 2129920 | } | |
| 5068 | 32768 | } | |
| 5069 | 4096 | } | |
| 5070 | else | ||
| 5071 | { | ||
| 5072 | 35328 | tempDMap.active_sub_script = 0; | |
| 5073 | 35328 | tempDMap.passive_sub_script = 0; | |
| 5074 |
2/2✓ Branch 0 taken 282624 times.
✓ Branch 1 taken 35328 times.
|
317952 | for(int32_t q = 0; q < 8; ++q) |
| 5075 | { | ||
| 5076 | 282624 | tempDMap.sub_initD[q] = 0; | |
| 5077 |
2/2✓ Branch 0 taken 18370560 times.
✓ Branch 1 taken 282624 times.
|
18653184 | for(int32_t w = 0; w < 65; ++w) |
| 5078 | 18370560 | tempDMap.sub_initD_label[q][w] = 0; | |
| 5079 | 282624 | } | |
| 5080 | } | ||
| 5081 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if(s_version >= 15) |
| 5082 | { | ||
| 5083 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetw(&tempDMap.onmap_script,f,keepdata)) |
| 5084 | { | ||
| 5085 | ✗ | return qe_invalid; | |
| 5086 | } | ||
| 5087 |
2/2✓ Branch 0 taken 32768 times.
✓ Branch 1 taken 4096 times.
|
36864 | for ( int32_t q = 0; q < 8; ++q ) |
| 5088 | { | ||
| 5089 |
1/2✓ Branch 0 taken 32768 times.
✗ Branch 1 not taken.
|
32768 | if(!p_igetl(&tempDMap.onmap_initD[q],f,keepdata)) |
| 5090 | { | ||
| 5091 | ✗ | return qe_invalid; | |
| 5092 | } | ||
| 5093 | 32768 | } | |
| 5094 |
2/2✓ Branch 0 taken 32768 times.
✓ Branch 1 taken 4096 times.
|
36864 | for(int32_t q = 0; q < 8; ++q) |
| 5095 | { | ||
| 5096 |
2/2✓ Branch 0 taken 2129920 times.
✓ Branch 1 taken 32768 times.
|
2162688 | for ( int32_t w = 0; w < 65; ++w ) |
| 5097 | { | ||
| 5098 |
1/2✓ Branch 0 taken 2129920 times.
✗ Branch 1 not taken.
|
2129920 | if(!p_getc(&tempDMap.onmap_initD_label[q][w],f,keepdata)) |
| 5099 | { | ||
| 5100 | ✗ | return qe_invalid; | |
| 5101 | } | ||
| 5102 | 2129920 | } | |
| 5103 | 32768 | } | |
| 5104 | 4096 | } | |
| 5105 | else | ||
| 5106 | { | ||
| 5107 | 35328 | tempDMap.onmap_script = 0; | |
| 5108 |
2/2✓ Branch 0 taken 282624 times.
✓ Branch 1 taken 35328 times.
|
317952 | for(int32_t q = 0; q < 8; ++q) |
| 5109 | { | ||
| 5110 | 282624 | tempDMap.onmap_initD[q] = 0; | |
| 5111 |
2/2✓ Branch 0 taken 18370560 times.
✓ Branch 1 taken 282624 times.
|
18653184 | for(int32_t w = 0; w < 65; ++w) |
| 5112 | { | ||
| 5113 | 18370560 | tempDMap.onmap_initD_label[q][w] = 0; | |
| 5114 | 18370560 | } | |
| 5115 | 282624 | } | |
| 5116 | } | ||
| 5117 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if(s_version >= 16) |
| 5118 | { | ||
| 5119 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4096 times.
|
4096 | if(!p_igetw(&tempDMap.mirrorDMap,f,keepdata)) |
| 5120 | { | ||
| 5121 | ✗ | return qe_invalid; | |
| 5122 | } | ||
| 5123 | 4096 | } | |
| 5124 | else | ||
| 5125 | { | ||
| 5126 | 35328 | tempDMap.mirrorDMap = -1; | |
| 5127 | } | ||
| 5128 | |||
| 5129 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 39424 times.
|
39424 | if(keepdata==true) |
| 5130 | { | ||
| 5131 | 39424 | memcpy(&DMaps[i], &tempDMap, sizeof(tempDMap)); | |
| 5132 | 39424 | } | |
| 5133 | 39424 | } | |
| 5134 | |||
| 5135 | 77 | return 0; | |
| 5136 | 77 | } | |
| 5137 | |||
| 5138 | 77 | int32_t readmisccolors(PACKFILE *f, zquestheader *Header, miscQdata *Misc, bool keepdata) | |
| 5139 | { | ||
| 5140 | //these are here to bypass compiler warnings about unused arguments | ||
| 5141 | 77 | Header=Header; | |
| 5142 | |||
| 5143 | miscQdata temp_misc; | ||
| 5144 | 77 | word s_version=0, s_cversion=0; | |
| 5145 | 77 | int32_t tempsize=0; | |
| 5146 | word dummyw; | ||
| 5147 | |||
| 5148 | 77 | memcpy(&temp_misc,Misc,sizeof(temp_misc)); | |
| 5149 | |||
| 5150 | //section version info | ||
| 5151 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(!p_igetw(&s_version,f,true)) |
| 5152 | { | ||
| 5153 | ✗ | return qe_invalid; | |
| 5154 | } | ||
| 5155 | |||
| 5156 | 77 | FFCore.quest_format[vColours] = s_version; | |
| 5157 | |||
| 5158 | 77 | al_trace("Misc Colours section version: %d\n", s_version); | |
| 5159 | |||
| 5160 | //al_trace("Misc. colors version %d\n", s_version); | ||
| 5161 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_cversion,f,true)) |
| 5162 | { | ||
| 5163 | ✗ | return qe_invalid; | |
| 5164 | } | ||
| 5165 | |||
| 5166 | |||
| 5167 | //section size | ||
| 5168 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&tempsize,f,true)) |
| 5169 | { | ||
| 5170 | ✗ | return qe_invalid; | |
| 5171 | } | ||
| 5172 | |||
| 5173 | //finally... section data | ||
| 5174 | 77 | readsize=0; | |
| 5175 | |||
| 5176 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.text,f,true)) |
| 5177 | { | ||
| 5178 | ✗ | return qe_invalid; | |
| 5179 | } | ||
| 5180 | |||
| 5181 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.caption,f,true)) |
| 5182 | { | ||
| 5183 | ✗ | return qe_invalid; | |
| 5184 | } | ||
| 5185 | |||
| 5186 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.overw_bg,f,true)) |
| 5187 | { | ||
| 5188 | ✗ | return qe_invalid; | |
| 5189 | } | ||
| 5190 | |||
| 5191 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.dngn_bg,f,true)) |
| 5192 | { | ||
| 5193 | ✗ | return qe_invalid; | |
| 5194 | } | ||
| 5195 | |||
| 5196 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.dngn_fg,f,true)) |
| 5197 | { | ||
| 5198 | ✗ | return qe_invalid; | |
| 5199 | } | ||
| 5200 | |||
| 5201 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.cave_fg,f,true)) |
| 5202 | { | ||
| 5203 | ✗ | return qe_invalid; | |
| 5204 | } | ||
| 5205 | |||
| 5206 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.bs_dk,f,true)) |
| 5207 | { | ||
| 5208 | ✗ | return qe_invalid; | |
| 5209 | } | ||
| 5210 | |||
| 5211 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.bs_goal,f,true)) |
| 5212 | { | ||
| 5213 | ✗ | return qe_invalid; | |
| 5214 | } | ||
| 5215 | |||
| 5216 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.compass_lt,f,true)) |
| 5217 | { | ||
| 5218 | ✗ | return qe_invalid; | |
| 5219 | } | ||
| 5220 | |||
| 5221 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.compass_dk,f,true)) |
| 5222 | { | ||
| 5223 | ✗ | return qe_invalid; | |
| 5224 | } | ||
| 5225 | |||
| 5226 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.subscr_bg,f,true)) |
| 5227 | { | ||
| 5228 | ✗ | return qe_invalid; | |
| 5229 | } | ||
| 5230 | |||
| 5231 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.triframe_color,f,true)) |
| 5232 | { | ||
| 5233 | ✗ | return qe_invalid; | |
| 5234 | } | ||
| 5235 | |||
| 5236 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.hero_dot,f,true)) |
| 5237 | { | ||
| 5238 | ✗ | return qe_invalid; | |
| 5239 | } | ||
| 5240 | |||
| 5241 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.bmap_bg,f,true)) |
| 5242 | { | ||
| 5243 | ✗ | return qe_invalid; | |
| 5244 | } | ||
| 5245 | |||
| 5246 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.bmap_fg,f,true)) |
| 5247 | { | ||
| 5248 | ✗ | return qe_invalid; | |
| 5249 | } | ||
| 5250 | |||
| 5251 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.triforce_cset,f,true)) |
| 5252 | { | ||
| 5253 | ✗ | return qe_invalid; | |
| 5254 | } | ||
| 5255 | |||
| 5256 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.triframe_cset,f,true)) |
| 5257 | { | ||
| 5258 | ✗ | return qe_invalid; | |
| 5259 | } | ||
| 5260 | |||
| 5261 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.overworld_map_cset,f,true)) |
| 5262 | { | ||
| 5263 | ✗ | return qe_invalid; | |
| 5264 | } | ||
| 5265 | |||
| 5266 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.dungeon_map_cset,f,true)) |
| 5267 | { | ||
| 5268 | ✗ | return qe_invalid; | |
| 5269 | } | ||
| 5270 | |||
| 5271 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.blueframe_cset,f,true)) |
| 5272 | { | ||
| 5273 | ✗ | return qe_invalid; | |
| 5274 | } | ||
| 5275 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(s_version < 4) |
| 5276 | { | ||
| 5277 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | if(!p_igetw(&dummyw,f,true)) |
| 5278 | ✗ | return qe_invalid; | |
| 5279 | 69 | temp_misc.colors.triforce_tile = dummyw; | |
| 5280 | |||
| 5281 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | if(!p_igetw(&dummyw,f,true)) |
| 5282 | ✗ | return qe_invalid; | |
| 5283 | 69 | temp_misc.colors.triframe_tile = dummyw; | |
| 5284 | |||
| 5285 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | if(!p_igetw(&dummyw,f,true)) |
| 5286 | ✗ | return qe_invalid; | |
| 5287 | 69 | temp_misc.colors.overworld_map_tile = dummyw; | |
| 5288 | |||
| 5289 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | if(!p_igetw(&dummyw,f,true)) |
| 5290 | ✗ | return qe_invalid; | |
| 5291 | 69 | temp_misc.colors.dungeon_map_tile = dummyw; | |
| 5292 | |||
| 5293 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | if(!p_igetw(&dummyw,f,true)) |
| 5294 | ✗ | return qe_invalid; | |
| 5295 | 69 | temp_misc.colors.blueframe_tile = dummyw; | |
| 5296 | |||
| 5297 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | if(!p_igetw(&dummyw,f,true)) |
| 5298 | ✗ | return qe_invalid; | |
| 5299 | 69 | temp_misc.colors.HCpieces_tile = dummyw; | |
| 5300 | 69 | } | |
| 5301 | |||
| 5302 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.HCpieces_cset,f,true)) |
| 5303 | { | ||
| 5304 | ✗ | return qe_invalid; | |
| 5305 | } | ||
| 5306 | |||
| 5307 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.subscr_shadow,f,true)) |
| 5308 | { | ||
| 5309 | ✗ | return qe_invalid; | |
| 5310 | } | ||
| 5311 | |||
| 5312 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(s_version < 2) |
| 5313 | { | ||
| 5314 | ✗ | temp_misc.colors.msgtext = 0x01; | |
| 5315 | } | ||
| 5316 | else | ||
| 5317 | { | ||
| 5318 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_getc(&temp_misc.colors.msgtext, f, true)) |
| 5319 | { | ||
| 5320 | ✗ | return qe_invalid; | |
| 5321 | } | ||
| 5322 | } | ||
| 5323 | |||
| 5324 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
|
77 | if ( s_version >= 3 ) //expanded tile pages to 825 |
| 5325 | { | ||
| 5326 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(!p_igetl(&temp_misc.colors.triforce_tile,f,true)) |
| 5327 | { | ||
| 5328 | ✗ | return qe_invalid; | |
| 5329 | } | ||
| 5330 | |||
| 5331 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(!p_igetl(&temp_misc.colors.triframe_tile,f,true)) |
| 5332 | { | ||
| 5333 | ✗ | return qe_invalid; | |
| 5334 | } | ||
| 5335 | |||
| 5336 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(!p_igetl(&temp_misc.colors.overworld_map_tile,f,true)) |
| 5337 | { | ||
| 5338 | ✗ | return qe_invalid; | |
| 5339 | } | ||
| 5340 | |||
| 5341 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(!p_igetl(&temp_misc.colors.dungeon_map_tile,f,true)) |
| 5342 | { | ||
| 5343 | ✗ | return qe_invalid; | |
| 5344 | } | ||
| 5345 | |||
| 5346 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(!p_igetl(&temp_misc.colors.blueframe_tile,f,true)) |
| 5347 | { | ||
| 5348 | ✗ | return qe_invalid; | |
| 5349 | } | ||
| 5350 | |||
| 5351 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(!p_igetl(&temp_misc.colors.HCpieces_tile,f,true)) |
| 5352 | { | ||
| 5353 | ✗ | return qe_invalid; | |
| 5354 | } | ||
| 5355 | 8 | } | |
| 5356 | |||
| 5357 | |||
| 5358 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata==true) |
| 5359 | { | ||
| 5360 | 77 | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 5361 | 77 | } | |
| 5362 | |||
| 5363 | 77 | return 0; | |
| 5364 | 77 | } | |
| 5365 | |||
| 5366 | 77 | int32_t readgameicons(PACKFILE *f, zquestheader *, miscQdata *Misc, bool keepdata) | |
| 5367 | { | ||
| 5368 | miscQdata temp_misc; | ||
| 5369 | 77 | word s_version=0, s_cversion=0; | |
| 5370 | byte icons; | ||
| 5371 | 77 | int32_t tempsize=0; | |
| 5372 | |||
| 5373 | 77 | memcpy(&temp_misc,Misc,sizeof(temp_misc)); | |
| 5374 | |||
| 5375 | //section version info | ||
| 5376 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(!p_igetw(&s_version,f,true)) |
| 5377 | { | ||
| 5378 | ✗ | return qe_invalid; | |
| 5379 | } | ||
| 5380 | |||
| 5381 | 77 | FFCore.quest_format[vIcons] = s_version; | |
| 5382 | |||
| 5383 | //al_trace("Game icons version %d\n", s_version); | ||
| 5384 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_cversion,f,true)) |
| 5385 | { | ||
| 5386 | ✗ | return qe_invalid; | |
| 5387 | } | ||
| 5388 | |||
| 5389 | |||
| 5390 | //section size | ||
| 5391 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&tempsize,f,true)) |
| 5392 | { | ||
| 5393 | ✗ | return qe_invalid; | |
| 5394 | } | ||
| 5395 | |||
| 5396 | //finally... section data | ||
| 5397 | 77 | readsize=0; | |
| 5398 | |||
| 5399 | 77 | icons=4; | |
| 5400 | |||
| 5401 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if ( s_version >= 10 ) |
| 5402 | { | ||
| 5403 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t i=0; i<icons; i++) |
| 5404 | { | ||
| 5405 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_igetl(&temp_misc.icons[i],f,true)) |
| 5406 | { | ||
| 5407 | ✗ | return qe_invalid; | |
| 5408 | } | ||
| 5409 | 32 | } | |
| 5410 | 8 | } | |
| 5411 | else | ||
| 5412 | { | ||
| 5413 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 69 times.
|
345 | for(int32_t i=0; i<icons; i++) |
| 5414 | { | ||
| 5415 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(!p_igetw(&temp_misc.icons[i],f,true)) |
| 5416 | { | ||
| 5417 | ✗ | return qe_invalid; | |
| 5418 | } | ||
| 5419 | 276 | } | |
| 5420 | } | ||
| 5421 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata==true) |
| 5422 | { | ||
| 5423 | 77 | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 5424 | 77 | } | |
| 5425 | |||
| 5426 | 77 | return 0; | |
| 5427 | 77 | } | |
| 5428 | |||
| 5429 | 77 | int32_t readmisc(PACKFILE *f, zquestheader *Header, miscQdata *Misc, bool keepdata) | |
| 5430 | { | ||
| 5431 | 77 | word maxinfos=256; | |
| 5432 | 77 | word maxshops=256; | |
| 5433 | 77 | word shops=16, infos=16, warprings=8, palcycles=256, windwarps=9, triforces=8, icons=4; | |
| 5434 | 77 | word ponds=16, pondsize=72, expansionsize=98*2; | |
| 5435 | byte tempbyte, padding; | ||
| 5436 | miscQdata temp_misc; | ||
| 5437 | 77 | word s_version=0, s_cversion=0; | |
| 5438 | word swaptmp; | ||
| 5439 | 77 | int32_t tempsize=0; | |
| 5440 | |||
| 5441 | 77 | memcpy(&temp_misc,Misc,sizeof(temp_misc)); | |
| 5442 | |||
| 5443 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<maxshops; ++i) |
| 5444 | { | ||
| 5445 | 19712 | memset(&temp_misc.shop, 0, sizeof(shoptype)*256); | |
| 5446 | 19712 | } | |
| 5447 | |||
| 5448 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<maxinfos; ++i) |
| 5449 | { | ||
| 5450 | 19712 | memset(&temp_misc.info, 0, sizeof(infotype)*256); | |
| 5451 | 19712 | } | |
| 5452 | |||
| 5453 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(Header->zelda_version > 0x192) |
| 5454 | { | ||
| 5455 | //section version info | ||
| 5456 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_version,f,true)) |
| 5457 | { | ||
| 5458 | ✗ | return qe_invalid; | |
| 5459 | } | ||
| 5460 | |||
| 5461 | 77 | FFCore.quest_format[vMisc] = s_version; | |
| 5462 | |||
| 5463 | //al_trace("Misc. data version %d\n", s_version); | ||
| 5464 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_cversion,f,true)) |
| 5465 | { | ||
| 5466 | ✗ | return qe_invalid; | |
| 5467 | } | ||
| 5468 | |||
| 5469 | |||
| 5470 | //section size | ||
| 5471 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&tempsize,f,true)) |
| 5472 | { | ||
| 5473 | ✗ | return qe_invalid; | |
| 5474 | } | ||
| 5475 | 77 | } | |
| 5476 | |||
| 5477 | //finally... section data | ||
| 5478 | 77 | readsize=0; | |
| 5479 | |||
| 5480 | //shops | ||
| 5481 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(Header->zelda_version > 0x192) |
| 5482 | { | ||
| 5483 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&shops,f,true)) |
| 5484 | { | ||
| 5485 | ✗ | return qe_invalid; | |
| 5486 | } | ||
| 5487 | 77 | } | |
| 5488 | |||
| 5489 |
2/2✓ Branch 0 taken 690 times.
✓ Branch 1 taken 77 times.
|
767 | for(int32_t i=0; i<shops; i++) |
| 5490 | { | ||
| 5491 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 690 times.
|
690 | if(s_version > 6) |
| 5492 | { | ||
| 5493 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 690 times.
|
690 | if(!pfread(temp_misc.shop[i].name,sizeof(temp_misc.shop[i].name),f,true)) |
| 5494 | { | ||
| 5495 | ✗ | return qe_invalid; | |
| 5496 | } | ||
| 5497 | 690 | } | |
| 5498 | |||
| 5499 |
2/2✓ Branch 0 taken 2070 times.
✓ Branch 1 taken 690 times.
|
2760 | for(int32_t j=0; j<3; j++) |
| 5500 | { | ||
| 5501 |
1/2✓ Branch 0 taken 2070 times.
✗ Branch 1 not taken.
|
2070 | if(!p_getc(&temp_misc.shop[i].item[j],f,true)) |
| 5502 | { | ||
| 5503 | ✗ | return qe_invalid; | |
| 5504 | } | ||
| 5505 | |||
| 5506 |
1/2✓ Branch 0 taken 2070 times.
✗ Branch 1 not taken.
|
2070 | if(s_version < 4) |
| 5507 | { | ||
| 5508 | ✗ | temp_misc.shop[i].hasitem[j] = (temp_misc.shop[i].item[j] == 0) ? 0 : 1; | |
| 5509 | } | ||
| 5510 | 2070 | } | |
| 5511 | |||
| 5512 |
1/2✓ Branch 0 taken 690 times.
✗ Branch 1 not taken.
|
690 | if(Header->zelda_version < 0x193) |
| 5513 | { | ||
| 5514 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 5515 | { | ||
| 5516 | ✗ | return qe_invalid; | |
| 5517 | } | ||
| 5518 | } | ||
| 5519 | |||
| 5520 |
2/2✓ Branch 0 taken 2070 times.
✓ Branch 1 taken 690 times.
|
2760 | for(int32_t j=0; j<3; j++) |
| 5521 | { | ||
| 5522 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2070 times.
|
2070 | if(!p_igetw(&temp_misc.shop[i].price[j],f,true)) |
| 5523 | { | ||
| 5524 | ✗ | return qe_invalid; | |
| 5525 | } | ||
| 5526 | 2070 | } | |
| 5527 | |||
| 5528 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 690 times.
|
690 | if(s_version > 3) |
| 5529 | { | ||
| 5530 |
2/2✓ Branch 0 taken 2070 times.
✓ Branch 1 taken 690 times.
|
2760 | for(int32_t j=0; j<3; j++) |
| 5531 | { | ||
| 5532 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2070 times.
|
2070 | if(!p_getc(&temp_misc.shop[i].hasitem[j],f,true)) |
| 5533 | ✗ | return qe_invalid; | |
| 5534 | 2070 | } | |
| 5535 | 690 | } | |
| 5536 | |||
| 5537 | /* | ||
| 5538 | if(s_version < 8) | ||
| 5539 | { | ||
| 5540 | for(int32_t j=0; j<3; j++) | ||
| 5541 | { | ||
| 5542 | (&temp_misc.shop[i].str[j])=0; //initialise. | ||
| 5543 | } | ||
| 5544 | } | ||
| 5545 | */ | ||
| 5546 | 690 | } | |
| 5547 | |||
| 5548 | //filter all the 0 items to the end (yeah, bubble sort; sue me) | ||
| 5549 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<maxshops; ++i) |
| 5550 | { | ||
| 5551 |
2/2✓ Branch 0 taken 39424 times.
✓ Branch 1 taken 19712 times.
|
59136 | for(int32_t j=0; j<3-1; j++) |
| 5552 | { | ||
| 5553 |
2/2✓ Branch 0 taken 59136 times.
✓ Branch 1 taken 39424 times.
|
98560 | for(int32_t k=0; k<2-j; k++) |
| 5554 | { | ||
| 5555 |
2/2✓ Branch 0 taken 1723 times.
✓ Branch 1 taken 57413 times.
|
59136 | if(temp_misc.shop[i].hasitem[k]==0) |
| 5556 | { | ||
| 5557 | 57413 | swaptmp = temp_misc.shop[i].item[k]; | |
| 5558 | 57413 | temp_misc.shop[i].item[k] = temp_misc.shop[i].item[k+1]; | |
| 5559 | 57413 | temp_misc.shop[i].item[k+1] = swaptmp; | |
| 5560 | 57413 | swaptmp = temp_misc.shop[i].price[k]; | |
| 5561 | 57413 | temp_misc.shop[i].price[k] = temp_misc.shop[i].price[k+1]; | |
| 5562 | 57413 | temp_misc.shop[i].price[k+1] = swaptmp; | |
| 5563 | 57413 | swaptmp = temp_misc.shop[i].hasitem[k]; | |
| 5564 | 57413 | temp_misc.shop[i].hasitem[k] = temp_misc.shop[i].hasitem[k+1]; | |
| 5565 | 57413 | temp_misc.shop[i].hasitem[k+1] = swaptmp; | |
| 5566 | 57413 | } | |
| 5567 | 59136 | } | |
| 5568 | 39424 | } | |
| 5569 | 19712 | } | |
| 5570 | |||
| 5571 | //infos | ||
| 5572 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(Header->zelda_version > 0x192) |
| 5573 | { | ||
| 5574 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&infos,f,true)) |
| 5575 | { | ||
| 5576 | ✗ | return qe_invalid; | |
| 5577 | } | ||
| 5578 | 77 | } | |
| 5579 | |||
| 5580 |
2/2✓ Branch 0 taken 1136 times.
✓ Branch 1 taken 77 times.
|
1213 | for(int32_t i=0; i<infos; i++) |
| 5581 | { | ||
| 5582 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1136 times.
|
1136 | if(s_version > 6) |
| 5583 | { | ||
| 5584 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1136 times.
|
1136 | if(!pfread(temp_misc.info[i].name,sizeof(temp_misc.info[i].name),f,true)) |
| 5585 | { | ||
| 5586 | ✗ | return qe_invalid; | |
| 5587 | } | ||
| 5588 | 1136 | } | |
| 5589 | |||
| 5590 |
2/2✓ Branch 0 taken 3408 times.
✓ Branch 1 taken 1136 times.
|
4544 | for(int32_t j=0; j<3; j++) |
| 5591 | { | ||
| 5592 |
1/4✓ Branch 0 taken 3408 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3408 | if((Header->zelda_version < 0x192)|| |
| 5593 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3408 times.
|
3408 | ((Header->zelda_version == 0x192)&&(Header->build<146))) |
| 5594 | { | ||
| 5595 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 5596 | { | ||
| 5597 | ✗ | return qe_invalid; | |
| 5598 | } | ||
| 5599 | |||
| 5600 | ✗ | temp_misc.info[i].str[j]=tempbyte; | |
| 5601 | } | ||
| 5602 | else | ||
| 5603 | { | ||
| 5604 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3408 times.
|
3408 | if(!p_igetw(&temp_misc.info[i].str[j],f,true)) |
| 5605 | { | ||
| 5606 | ✗ | return qe_invalid; | |
| 5607 | } | ||
| 5608 | } | ||
| 5609 | 3408 | } | |
| 5610 | |||
| 5611 |
1/2✓ Branch 0 taken 1136 times.
✗ Branch 1 not taken.
|
1136 | if(Header->zelda_version < 0x193) |
| 5612 | { | ||
| 5613 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 5614 | { | ||
| 5615 | ✗ | return qe_invalid; | |
| 5616 | } | ||
| 5617 | } | ||
| 5618 | |||
| 5619 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1136 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1136 | if((Header->zelda_version == 0x192)&&(Header->build>145)) |
| 5620 | { | ||
| 5621 | ✗ | if(!p_getc(&padding,f,true)) | |
| 5622 | { | ||
| 5623 | ✗ | return qe_invalid; | |
| 5624 | } | ||
| 5625 | } | ||
| 5626 | |||
| 5627 |
2/2✓ Branch 0 taken 3408 times.
✓ Branch 1 taken 1136 times.
|
4544 | for(int32_t j=0; j<3; j++) |
| 5628 | { | ||
| 5629 |
1/2✓ Branch 0 taken 3408 times.
✗ Branch 1 not taken.
|
3408 | if(!p_igetw(&temp_misc.info[i].price[j],f,true)) |
| 5630 | { | ||
| 5631 | ✗ | return qe_invalid; | |
| 5632 | } | ||
| 5633 | 3408 | } | |
| 5634 | 1136 | } | |
| 5635 | |||
| 5636 | //filter all the 0 strings to the end (yeah, bubble sort; sue me) | ||
| 5637 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<maxinfos; ++i) |
| 5638 | { | ||
| 5639 |
2/2✓ Branch 0 taken 39424 times.
✓ Branch 1 taken 19712 times.
|
59136 | for(int32_t j=0; j<3-1; j++) |
| 5640 | { | ||
| 5641 |
2/2✓ Branch 0 taken 59136 times.
✓ Branch 1 taken 39424 times.
|
98560 | for(int32_t k=0; k<2-j; k++) |
| 5642 | { | ||
| 5643 |
2/2✓ Branch 0 taken 1377 times.
✓ Branch 1 taken 57759 times.
|
59136 | if(temp_misc.info[i].str[k]==0) |
| 5644 | { | ||
| 5645 | 57759 | swaptmp = temp_misc.info[i].str[k]; | |
| 5646 | 57759 | temp_misc.info[i].str[k] = temp_misc.info[i].str[k+1]; | |
| 5647 | 57759 | temp_misc.info[i].str[k+1] = swaptmp; | |
| 5648 | 57759 | swaptmp = temp_misc.info[i].price[k]; | |
| 5649 | 57759 | temp_misc.info[i].price[k] = temp_misc.info[i].price[k+1]; | |
| 5650 | 57759 | temp_misc.info[i].price[k+1] = swaptmp; | |
| 5651 | 57759 | } | |
| 5652 | 59136 | } | |
| 5653 | 39424 | } | |
| 5654 | 19712 | } | |
| 5655 | |||
| 5656 | |||
| 5657 | //warp rings | ||
| 5658 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(s_version > 5) |
| 5659 | 77 | warprings++; | |
| 5660 | |||
| 5661 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(Header->zelda_version > 0x192) |
| 5662 | { | ||
| 5663 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&warprings,f,true)) |
| 5664 | { | ||
| 5665 | ✗ | return qe_invalid; | |
| 5666 | } | ||
| 5667 | 77 | } | |
| 5668 | |||
| 5669 |
2/2✓ Branch 0 taken 739 times.
✓ Branch 1 taken 77 times.
|
816 | for(int32_t i=0; i<warprings; i++) |
| 5670 | { | ||
| 5671 |
2/2✓ Branch 0 taken 6651 times.
✓ Branch 1 taken 739 times.
|
7390 | for(int32_t j=0; j<8+((s_version > 5)?1:0); j++) |
| 5672 | { | ||
| 5673 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6651 times.
|
6651 | if(s_version <= 3) |
| 5674 | { | ||
| 5675 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 5676 | { | ||
| 5677 | ✗ | return qe_invalid; | |
| 5678 | } | ||
| 5679 | |||
| 5680 | ✗ | temp_misc.warp[i].dmap[j]=(word)tempbyte; | |
| 5681 | } | ||
| 5682 | else | ||
| 5683 | { | ||
| 5684 |
1/2✓ Branch 0 taken 6651 times.
✗ Branch 1 not taken.
|
6651 | if(!p_igetw(&temp_misc.warp[i].dmap[j],f,true)) |
| 5685 | { | ||
| 5686 | ✗ | return qe_invalid; | |
| 5687 | } | ||
| 5688 | } | ||
| 5689 | 6651 | } | |
| 5690 | |||
| 5691 |
2/2✓ Branch 0 taken 6651 times.
✓ Branch 1 taken 739 times.
|
7390 | for(int32_t j=0; j<8+((s_version > 5)?1:0); j++) |
| 5692 | { | ||
| 5693 |
1/2✓ Branch 0 taken 6651 times.
✗ Branch 1 not taken.
|
6651 | if(!p_getc(&temp_misc.warp[i].scr[j],f,true)) |
| 5694 | { | ||
| 5695 | ✗ | return qe_invalid; | |
| 5696 | } | ||
| 5697 | 6651 | } | |
| 5698 | |||
| 5699 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 739 times.
|
739 | if(!p_getc(&temp_misc.warp[i].size,f,true)) |
| 5700 | { | ||
| 5701 | ✗ | return qe_invalid; | |
| 5702 | } | ||
| 5703 | |||
| 5704 |
1/2✓ Branch 0 taken 739 times.
✗ Branch 1 not taken.
|
739 | if(Header->zelda_version < 0x193) |
| 5705 | { | ||
| 5706 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 5707 | { | ||
| 5708 | ✗ | return qe_invalid; | |
| 5709 | } | ||
| 5710 | } | ||
| 5711 | 739 | } | |
| 5712 | |||
| 5713 | //palette cycles | ||
| 5714 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(Header->zelda_version < 0x193) //in 1.93+, palette cycling is saved with the palettes |
| 5715 | { | ||
| 5716 | ✗ | for(int32_t i=0; i<256; i++) | |
| 5717 | { | ||
| 5718 | ✗ | for(int32_t j=0; j<3; j++) | |
| 5719 | { | ||
| 5720 | ✗ | temp_misc.cycles[i][j].first=0; | |
| 5721 | ✗ | temp_misc.cycles[i][j].count=0; | |
| 5722 | ✗ | temp_misc.cycles[i][j].speed=0; | |
| 5723 | } | ||
| 5724 | } | ||
| 5725 | |||
| 5726 | ✗ | if((Header->zelda_version < 0x192)|| | |
| 5727 | ✗ | ((Header->zelda_version == 0x192)&&(Header->build<73))) | |
| 5728 | { | ||
| 5729 | ✗ | palcycles=16; | |
| 5730 | } | ||
| 5731 | |||
| 5732 | ✗ | for(int32_t i=0; i<palcycles; i++) | |
| 5733 | { | ||
| 5734 | ✗ | for(int32_t j=0; j<3; j++) | |
| 5735 | { | ||
| 5736 | ✗ | if(!p_getc(&temp_misc.cycles[i][j].first,f,true)) | |
| 5737 | { | ||
| 5738 | ✗ | return qe_invalid; | |
| 5739 | } | ||
| 5740 | |||
| 5741 | ✗ | if(!p_getc(&temp_misc.cycles[i][j].count,f,true)) | |
| 5742 | { | ||
| 5743 | ✗ | return qe_invalid; | |
| 5744 | } | ||
| 5745 | |||
| 5746 | ✗ | if(!p_getc(&temp_misc.cycles[i][j].speed,f,true)) | |
| 5747 | { | ||
| 5748 | ✗ | return qe_invalid; | |
| 5749 | } | ||
| 5750 | } | ||
| 5751 | } | ||
| 5752 | } | ||
| 5753 | |||
| 5754 | //Wind warps are now just another warp ring. | ||
| 5755 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version <= 5) |
| 5756 | { | ||
| 5757 | ✗ | if(Header->zelda_version > 0x192) | |
| 5758 | { | ||
| 5759 | ✗ | if(!p_igetw(&windwarps,f,true)) | |
| 5760 | { | ||
| 5761 | ✗ | return qe_invalid; | |
| 5762 | } | ||
| 5763 | } | ||
| 5764 | |||
| 5765 | ✗ | for(int32_t i=0; i<windwarps; i++) | |
| 5766 | { | ||
| 5767 | ✗ | if(s_version <= 3) | |
| 5768 | { | ||
| 5769 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 5770 | { | ||
| 5771 | ✗ | return qe_invalid; | |
| 5772 | } | ||
| 5773 | |||
| 5774 | ✗ | temp_misc.warp[8].dmap[i]=tempbyte; | |
| 5775 | } | ||
| 5776 | else | ||
| 5777 | { | ||
| 5778 | ✗ | if(!p_igetw(&temp_misc.warp[8].dmap[i],f,true)) | |
| 5779 | { | ||
| 5780 | ✗ | return qe_invalid; | |
| 5781 | } | ||
| 5782 | } | ||
| 5783 | |||
| 5784 | ✗ | if(!p_getc(&temp_misc.warp[8].scr[i],f,true)) | |
| 5785 | { | ||
| 5786 | ✗ | return qe_invalid; | |
| 5787 | } | ||
| 5788 | |||
| 5789 | ✗ | temp_misc.warp[8].size = 9; | |
| 5790 | |||
| 5791 | ✗ | if(s_version == 5) | |
| 5792 | { | ||
| 5793 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 5794 | { | ||
| 5795 | ✗ | return qe_invalid; | |
| 5796 | } | ||
| 5797 | } | ||
| 5798 | } | ||
| 5799 | } | ||
| 5800 | |||
| 5801 | |||
| 5802 | //triforce pieces | ||
| 5803 |
2/2✓ Branch 0 taken 616 times.
✓ Branch 1 taken 77 times.
|
693 | for(int32_t i=0; i<triforces; i++) |
| 5804 | { | ||
| 5805 |
1/2✓ Branch 0 taken 616 times.
✗ Branch 1 not taken.
|
616 | if(!p_getc(&temp_misc.triforce[i],f,true)) |
| 5806 | { | ||
| 5807 | ✗ | return qe_invalid; | |
| 5808 | } | ||
| 5809 | 616 | } | |
| 5810 | |||
| 5811 | //misc color data | ||
| 5812 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version<3) |
| 5813 | { | ||
| 5814 | ✗ | if(!p_getc(&temp_misc.colors.text,f,true)) | |
| 5815 | { | ||
| 5816 | ✗ | return qe_invalid; | |
| 5817 | } | ||
| 5818 | |||
| 5819 | ✗ | if(!p_getc(&temp_misc.colors.caption,f,true)) | |
| 5820 | { | ||
| 5821 | ✗ | return qe_invalid; | |
| 5822 | } | ||
| 5823 | |||
| 5824 | ✗ | if(!p_getc(&temp_misc.colors.overw_bg,f,true)) | |
| 5825 | { | ||
| 5826 | ✗ | return qe_invalid; | |
| 5827 | } | ||
| 5828 | |||
| 5829 | ✗ | if(!p_getc(&temp_misc.colors.dngn_bg,f,true)) | |
| 5830 | { | ||
| 5831 | ✗ | return qe_invalid; | |
| 5832 | } | ||
| 5833 | |||
| 5834 | ✗ | if(!p_getc(&temp_misc.colors.dngn_fg,f,true)) | |
| 5835 | { | ||
| 5836 | ✗ | return qe_invalid; | |
| 5837 | } | ||
| 5838 | |||
| 5839 | ✗ | if(!p_getc(&temp_misc.colors.cave_fg,f,true)) | |
| 5840 | { | ||
| 5841 | ✗ | return qe_invalid; | |
| 5842 | } | ||
| 5843 | |||
| 5844 | ✗ | if(!p_getc(&temp_misc.colors.bs_dk,f,true)) | |
| 5845 | { | ||
| 5846 | ✗ | return qe_invalid; | |
| 5847 | } | ||
| 5848 | |||
| 5849 | ✗ | if(!p_getc(&temp_misc.colors.bs_goal,f,true)) | |
| 5850 | { | ||
| 5851 | ✗ | return qe_invalid; | |
| 5852 | } | ||
| 5853 | |||
| 5854 | ✗ | if(!p_getc(&temp_misc.colors.compass_lt,f,true)) | |
| 5855 | { | ||
| 5856 | ✗ | return qe_invalid; | |
| 5857 | } | ||
| 5858 | |||
| 5859 | ✗ | if(!p_getc(&temp_misc.colors.compass_dk,f,true)) | |
| 5860 | { | ||
| 5861 | ✗ | return qe_invalid; | |
| 5862 | } | ||
| 5863 | |||
| 5864 | ✗ | if(!p_getc(&temp_misc.colors.subscr_bg,f,true)) | |
| 5865 | { | ||
| 5866 | ✗ | return qe_invalid; | |
| 5867 | } | ||
| 5868 | |||
| 5869 | ✗ | if(!p_getc(&temp_misc.colors.triframe_color,f,true)) | |
| 5870 | { | ||
| 5871 | ✗ | return qe_invalid; | |
| 5872 | } | ||
| 5873 | |||
| 5874 | ✗ | if(!p_getc(&temp_misc.colors.hero_dot,f,true)) | |
| 5875 | { | ||
| 5876 | ✗ | return qe_invalid; | |
| 5877 | } | ||
| 5878 | |||
| 5879 | ✗ | if(!p_getc(&temp_misc.colors.bmap_bg,f,true)) | |
| 5880 | { | ||
| 5881 | ✗ | return qe_invalid; | |
| 5882 | } | ||
| 5883 | |||
| 5884 | ✗ | if(!p_getc(&temp_misc.colors.bmap_fg,f,true)) | |
| 5885 | { | ||
| 5886 | ✗ | return qe_invalid; | |
| 5887 | } | ||
| 5888 | |||
| 5889 | ✗ | if(!p_getc(&temp_misc.colors.triforce_cset,f,true)) | |
| 5890 | { | ||
| 5891 | ✗ | return qe_invalid; | |
| 5892 | } | ||
| 5893 | |||
| 5894 | ✗ | if(!p_getc(&temp_misc.colors.triframe_cset,f,true)) | |
| 5895 | { | ||
| 5896 | ✗ | return qe_invalid; | |
| 5897 | } | ||
| 5898 | |||
| 5899 | ✗ | if(!p_getc(&temp_misc.colors.overworld_map_cset,f,true)) | |
| 5900 | { | ||
| 5901 | ✗ | return qe_invalid; | |
| 5902 | } | ||
| 5903 | |||
| 5904 | ✗ | if(!p_getc(&temp_misc.colors.dungeon_map_cset,f,true)) | |
| 5905 | { | ||
| 5906 | ✗ | return qe_invalid; | |
| 5907 | } | ||
| 5908 | |||
| 5909 | ✗ | if(!p_getc(&temp_misc.colors.blueframe_cset,f,true)) | |
| 5910 | { | ||
| 5911 | ✗ | return qe_invalid; | |
| 5912 | } | ||
| 5913 | |||
| 5914 | ✗ | if(!p_igetw(&temp_misc.colors.triforce_tile,f,true)) | |
| 5915 | { | ||
| 5916 | ✗ | return qe_invalid; | |
| 5917 | } | ||
| 5918 | |||
| 5919 | ✗ | if(!p_igetw(&temp_misc.colors.triframe_tile,f,true)) | |
| 5920 | { | ||
| 5921 | ✗ | return qe_invalid; | |
| 5922 | } | ||
| 5923 | |||
| 5924 | ✗ | if(!p_igetw(&temp_misc.colors.overworld_map_tile,f,true)) | |
| 5925 | { | ||
| 5926 | ✗ | return qe_invalid; | |
| 5927 | } | ||
| 5928 | |||
| 5929 | ✗ | if(!p_igetw(&temp_misc.colors.dungeon_map_tile,f,true)) | |
| 5930 | { | ||
| 5931 | ✗ | return qe_invalid; | |
| 5932 | } | ||
| 5933 | |||
| 5934 | ✗ | if(!p_igetw(&temp_misc.colors.blueframe_tile,f,true)) | |
| 5935 | { | ||
| 5936 | ✗ | return qe_invalid; | |
| 5937 | } | ||
| 5938 | |||
| 5939 | ✗ | if(!p_igetw(&temp_misc.colors.HCpieces_tile,f,true)) | |
| 5940 | { | ||
| 5941 | ✗ | return qe_invalid; | |
| 5942 | } | ||
| 5943 | |||
| 5944 | ✗ | if(!p_getc(&temp_misc.colors.HCpieces_cset,f,true)) | |
| 5945 | { | ||
| 5946 | ✗ | return qe_invalid; | |
| 5947 | } | ||
| 5948 | |||
| 5949 | ✗ | temp_misc.colors.msgtext = 0x01; | |
| 5950 | |||
| 5951 | ✗ | if(Header->zelda_version < 0x193) | |
| 5952 | { | ||
| 5953 | ✗ | for(int32_t i=0; i<7; i++) | |
| 5954 | { | ||
| 5955 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 5956 | { | ||
| 5957 | ✗ | return qe_invalid; | |
| 5958 | } | ||
| 5959 | } | ||
| 5960 | } | ||
| 5961 | |||
| 5962 | ✗ | if((Header->zelda_version == 0x192)&&(Header->build>145)) | |
| 5963 | { | ||
| 5964 | ✗ | for(int32_t i=0; i<256; i++) | |
| 5965 | { | ||
| 5966 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 5967 | { | ||
| 5968 | ✗ | return qe_invalid; | |
| 5969 | } | ||
| 5970 | } | ||
| 5971 | } | ||
| 5972 | |||
| 5973 | ✗ | if(s_version>1) | |
| 5974 | { | ||
| 5975 | ✗ | if(!p_getc(&temp_misc.colors.subscr_shadow,f,true)) | |
| 5976 | { | ||
| 5977 | ✗ | return qe_invalid; | |
| 5978 | } | ||
| 5979 | } | ||
| 5980 | |||
| 5981 | //save game icons | ||
| 5982 | ✗ | if((Header->zelda_version < 0x192)|| | |
| 5983 | ✗ | ((Header->zelda_version == 0x192)&&(Header->build<73))) | |
| 5984 | { | ||
| 5985 | ✗ | icons=3; | |
| 5986 | } | ||
| 5987 | |||
| 5988 | ✗ | for(int32_t i=0; i<icons; i++) | |
| 5989 | { | ||
| 5990 | ✗ | if(!p_igetw(&temp_misc.icons[i],f,true)) | |
| 5991 | { | ||
| 5992 | ✗ | return qe_invalid; | |
| 5993 | } | ||
| 5994 | } | ||
| 5995 | } | ||
| 5996 | |||
| 5997 |
1/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
77 | if((Header->zelda_version < 0x192)|| |
| 5998 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ((Header->zelda_version == 0x192)&&(Header->build<30))) |
| 5999 | { | ||
| 6000 | ✗ | if(keepdata==true) | |
| 6001 | { | ||
| 6002 | ✗ | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 6003 | } | ||
| 6004 | |||
| 6005 | ✗ | return 0; | |
| 6006 | } | ||
| 6007 | |||
| 6008 | //pond information | ||
| 6009 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(Header->zelda_version < 0x193) |
| 6010 | { | ||
| 6011 | ✗ | if((Header->zelda_version == 0x192)&&(Header->build<146)) | |
| 6012 | { | ||
| 6013 | ✗ | pondsize=25; | |
| 6014 | } | ||
| 6015 | |||
| 6016 | ✗ | for(int32_t i=0; i<ponds; i++) | |
| 6017 | { | ||
| 6018 | ✗ | for(int32_t j=0; j<pondsize; j++) | |
| 6019 | { | ||
| 6020 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 6021 | { | ||
| 6022 | ✗ | return qe_invalid; | |
| 6023 | |||
| 6024 | } | ||
| 6025 | } | ||
| 6026 | } | ||
| 6027 | } | ||
| 6028 | |||
| 6029 | //end string | ||
| 6030 |
1/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
77 | if((Header->zelda_version < 0x192)|| |
| 6031 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ((Header->zelda_version == 0x192)&&(Header->build<146))) |
| 6032 | { | ||
| 6033 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 6034 | { | ||
| 6035 | ✗ | return qe_invalid; | |
| 6036 | } | ||
| 6037 | |||
| 6038 | ✗ | temp_misc.endstring=tempbyte; | |
| 6039 | |||
| 6040 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 6041 | { | ||
| 6042 | ✗ | return qe_invalid; | |
| 6043 | } | ||
| 6044 | } | ||
| 6045 | else | ||
| 6046 | { | ||
| 6047 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&temp_misc.endstring,f,true)) |
| 6048 | { | ||
| 6049 | ✗ | return qe_invalid; | |
| 6050 | } | ||
| 6051 | } | ||
| 6052 | |||
| 6053 | //expansion | ||
| 6054 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(Header->zelda_version < 0x193) |
| 6055 | { | ||
| 6056 | ✗ | if((Header->zelda_version == 0x192)&&(Header->build<73)) | |
| 6057 | { | ||
| 6058 | ✗ | expansionsize=99*2; | |
| 6059 | } | ||
| 6060 | |||
| 6061 | ✗ | for(int32_t i=0; i<expansionsize; i++) | |
| 6062 | { | ||
| 6063 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 6064 | { | ||
| 6065 | ✗ | return qe_invalid; | |
| 6066 | } | ||
| 6067 | } | ||
| 6068 | } | ||
| 6069 | //shops v8 | ||
| 6070 | |||
| 6071 | |||
| 6072 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
|
77 | if(s_version >= 8) |
| 6073 | { | ||
| 6074 |
2/2✓ Branch 0 taken 112 times.
✓ Branch 1 taken 8 times.
|
120 | for(int32_t i=0; i<shops; i++) |
| 6075 | { | ||
| 6076 |
2/2✓ Branch 0 taken 336 times.
✓ Branch 1 taken 112 times.
|
448 | for(int32_t j=0; j<3; j++) |
| 6077 | { | ||
| 6078 |
1/2✓ Branch 0 taken 336 times.
✗ Branch 1 not taken.
|
336 | if(!p_igetw(&temp_misc.shop[i].str[j],f,true)) |
| 6079 | ✗ | return qe_invalid; | |
| 6080 | 336 | } | |
| 6081 | 112 | } | |
| 6082 | 8 | } | |
| 6083 | |||
| 6084 | 77 | memset(&temp_misc.questmisc, 0, sizeof(int32_t)*32); | |
| 6085 | 77 | memset(&temp_misc.questmisc_strings, 0, sizeof(char)*4096); | |
| 6086 | 77 | memset(&temp_misc.zscript_last_compiled_version, 0, sizeof(int32_t)); | |
| 6087 | |||
| 6088 | //v9 includes quest misc[32] | ||
| 6089 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
|
77 | if(s_version >= 9) |
| 6090 | { | ||
| 6091 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 8 times.
|
264 | for ( int32_t q = 0; q < 32; q++ ) |
| 6092 | { | ||
| 6093 |
1/2✓ Branch 0 taken 256 times.
✗ Branch 1 not taken.
|
256 | if(!p_igetl(&temp_misc.questmisc[q],f,true)) |
| 6094 | ✗ | return qe_invalid; | |
| 6095 | 256 | } | |
| 6096 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 8 times.
|
264 | for ( int32_t q = 0; q < 32; q++ ) |
| 6097 | { | ||
| 6098 |
2/2✓ Branch 0 taken 32768 times.
✓ Branch 1 taken 256 times.
|
33024 | for ( int32_t j = 0; j < 128; j++ ) |
| 6099 |
1/2✓ Branch 0 taken 32768 times.
✗ Branch 1 not taken.
|
32768 | if(!p_getc(&temp_misc.questmisc_strings[q][j],f,true)) |
| 6100 | ✗ | return qe_invalid; | |
| 6101 | 256 | } | |
| 6102 | 8 | } | |
| 6103 | |||
| 6104 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(s_version >= 11 ) |
| 6105 | { | ||
| 6106 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(!p_igetl(&temp_misc.zscript_last_compiled_version,f,true)) |
| 6107 | ✗ | return qe_invalid; | |
| 6108 | 8 | } | |
| 6109 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | else if(s_version < 11 ) |
| 6110 | { | ||
| 6111 | 69 | temp_misc.zscript_last_compiled_version = -1; | |
| 6112 | 69 | } | |
| 6113 | |||
| 6114 | 77 | FFCore.quest_format[vLastCompile] = temp_misc.zscript_last_compiled_version; | |
| 6115 | |||
| 6116 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(s_version >= 12) |
| 6117 | { | ||
| 6118 | byte spr; | ||
| 6119 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 8 times.
|
2056 | for(int32_t q = 0; q < sprMAX; ++q) |
| 6120 | { | ||
| 6121 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_getc(&spr,f,true)) |
| 6122 | ✗ | return qe_invalid; | |
| 6123 | 2048 | temp_misc.sprites[q] = spr; | |
| 6124 | 2048 | } | |
| 6125 | 8 | } | |
| 6126 | else | ||
| 6127 | { | ||
| 6128 | 69 | memset(&(temp_misc.sprites), 0, sizeof(temp_misc.sprites)); | |
| 6129 | //temp_misc.sprites[sprFALL] = ; | ||
| 6130 | } | ||
| 6131 | |||
| 6132 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(s_version >= 13) |
| 6133 | { | ||
| 6134 |
2/2✓ Branch 0 taken 512 times.
✓ Branch 1 taken 8 times.
|
520 | for(size_t q = 0; q < 64; ++q) |
| 6135 | { | ||
| 6136 | 512 | bottletype* bt = &(temp_misc.bottle_types[q]); | |
| 6137 |
1/2✓ Branch 0 taken 512 times.
✗ Branch 1 not taken.
|
512 | if (!pfread(bt->name, 32, f, true)) |
| 6138 | ✗ | return qe_invalid; | |
| 6139 |
2/2✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 512 times.
|
2048 | for(size_t j = 0; j < 3; ++j) |
| 6140 | { | ||
| 6141 |
1/2✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
|
1536 | if (!p_getc(&(bt->counter[j]), f, true)) |
| 6142 | ✗ | return qe_invalid; | |
| 6143 |
1/2✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
|
1536 | if (!p_igetw(&(bt->amount[j]), f, true)) |
| 6144 | ✗ | return qe_invalid; | |
| 6145 | 1536 | } | |
| 6146 |
1/2✓ Branch 0 taken 512 times.
✗ Branch 1 not taken.
|
512 | if (!p_getc(&(bt->flags), f, true)) |
| 6147 | ✗ | return qe_invalid; | |
| 6148 |
1/2✓ Branch 0 taken 512 times.
✗ Branch 1 not taken.
|
512 | if (!p_getc(&(bt->next_type), f, true)) |
| 6149 | ✗ | return qe_invalid; | |
| 6150 | 512 | } | |
| 6151 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 8 times.
|
2056 | for(size_t q = 0; q < 256; ++q) |
| 6152 | { | ||
| 6153 | 2048 | bottleshoptype* bst = &(temp_misc.bottle_shop_types[q]); | |
| 6154 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if (!pfread(bst->name, 32, f, true)) |
| 6155 | ✗ | return qe_invalid; | |
| 6156 |
2/2✓ Branch 0 taken 6144 times.
✓ Branch 1 taken 2048 times.
|
8192 | for(size_t j = 0; j < 3; ++j) |
| 6157 | { | ||
| 6158 |
1/2✓ Branch 0 taken 6144 times.
✗ Branch 1 not taken.
|
6144 | if (!p_getc(&(bst->fill[j]), f, true)) |
| 6159 | ✗ | return qe_invalid; | |
| 6160 |
1/2✓ Branch 0 taken 6144 times.
✗ Branch 1 not taken.
|
6144 | if (!p_igetw(&(bst->comb[j]), f, true)) |
| 6161 | ✗ | return qe_invalid; | |
| 6162 |
1/2✓ Branch 0 taken 6144 times.
✗ Branch 1 not taken.
|
6144 | if (!p_getc(&(bst->cset[j]), f, true)) |
| 6163 | ✗ | return qe_invalid; | |
| 6164 |
1/2✓ Branch 0 taken 6144 times.
✗ Branch 1 not taken.
|
6144 | if (!p_igetw(&(bst->price[j]), f, true)) |
| 6165 | ✗ | return qe_invalid; | |
| 6166 |
1/2✓ Branch 0 taken 6144 times.
✗ Branch 1 not taken.
|
6144 | if (!p_igetw(&(bst->str[j]), f, true)) |
| 6167 | ✗ | return qe_invalid; | |
| 6168 | 6144 | } | |
| 6169 | 2048 | } | |
| 6170 | 8 | } | |
| 6171 | else | ||
| 6172 | { | ||
| 6173 |
2/2✓ Branch 0 taken 4416 times.
✓ Branch 1 taken 69 times.
|
4485 | for(size_t q = 0; q < 64; ++q) |
| 6174 | 4416 | temp_misc.bottle_types[q].clear(); | |
| 6175 |
2/2✓ Branch 0 taken 17664 times.
✓ Branch 1 taken 69 times.
|
17733 | for(size_t q = 0; q < 256; ++q) |
| 6176 | 17664 | temp_misc.bottle_shop_types[q].clear(); | |
| 6177 | } | ||
| 6178 | |||
| 6179 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(s_version >= 14) |
| 6180 | { | ||
| 6181 | byte msfx; | ||
| 6182 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 8 times.
|
2056 | for(int32_t q = 0; q < sfxMAX; ++q) |
| 6183 | { | ||
| 6184 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_getc(&msfx,f,true)) |
| 6185 | ✗ | return qe_invalid; | |
| 6186 | 2048 | temp_misc.miscsfx[q] = msfx; | |
| 6187 | 2048 | } | |
| 6188 | 8 | } | |
| 6189 | else | ||
| 6190 | { | ||
| 6191 | 69 | memset(&(temp_misc.miscsfx), 0, sizeof(temp_misc.miscsfx)); | |
| 6192 | 69 | temp_misc.miscsfx[sfxBUSHGRASS] = WAV_ZN1GRASSCUT; | |
| 6193 | 69 | temp_misc.miscsfx[sfxLOWHEART] = WAV_ER; | |
| 6194 | } | ||
| 6195 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(s_version < 15) |
| 6196 | { | ||
| 6197 | 69 | temp_misc.miscsfx[sfxHURTPLAYER] = WAV_OUCH; | |
| 6198 | 69 | temp_misc.miscsfx[sfxHAMMERPOUND] = WAV_ZN1HAMMERPOST; | |
| 6199 | 69 | temp_misc.miscsfx[sfxSUBSCR_ITEM_ASSIGN] = WAV_PLACE; | |
| 6200 | 69 | temp_misc.miscsfx[sfxSUBSCR_CURSOR_MOVE] = WAV_CHIME; | |
| 6201 | 69 | temp_misc.miscsfx[sfxREFILL] = WAV_MSG; | |
| 6202 | 69 | temp_misc.miscsfx[sfxDRAIN] = WAV_MSG; | |
| 6203 | 69 | } | |
| 6204 | |||
| 6205 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata==true) |
| 6206 | { | ||
| 6207 | 77 | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 6208 | 77 | } | |
| 6209 | |||
| 6210 | 77 | return 0; | |
| 6211 | 77 | } | |
| 6212 | |||
| 6213 | extern char *item_string[ITEMCNT]; | ||
| 6214 | extern const char *old_item_string[iLast]; | ||
| 6215 | extern char *weapon_string[WPNCNT]; | ||
| 6216 | extern const char *old_weapon_string[wLast]; | ||
| 6217 | |||
| 6218 | 77 | int32_t readitems(PACKFILE *f, word version, word build, bool keepdata, bool zgpmode) | |
| 6219 | { | ||
| 6220 | byte padding; | ||
| 6221 | int32_t dummy; | ||
| 6222 | 77 | word items_to_read=MAXITEMS; | |
| 6223 | itemdata tempitem; | ||
| 6224 | 77 | word s_version=0, s_cversion=0; | |
| 6225 | word dummy_word; | ||
| 6226 | |||
| 6227 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(version < 0x186) |
| 6228 | { | ||
| 6229 | ✗ | items_to_read=64; | |
| 6230 | } | ||
| 6231 | |||
| 6232 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(version > 0x192) |
| 6233 | { | ||
| 6234 | 77 | items_to_read=0; | |
| 6235 | |||
| 6236 | //section version info | ||
| 6237 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_version,f,true)) |
| 6238 | { | ||
| 6239 | ✗ | return qe_invalid; | |
| 6240 | } | ||
| 6241 | |||
| 6242 | 77 | FFCore.quest_format[vItems] = s_version; | |
| 6243 | |||
| 6244 | //al_trace("Items version %d\n", s_version); | ||
| 6245 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_cversion,f,true)) |
| 6246 | { | ||
| 6247 | ✗ | return qe_invalid; | |
| 6248 | } | ||
| 6249 | |||
| 6250 | //section size | ||
| 6251 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&dummy,f,true)) |
| 6252 | { | ||
| 6253 | ✗ | return qe_invalid; | |
| 6254 | } | ||
| 6255 | |||
| 6256 | //finally... section data | ||
| 6257 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&items_to_read,f,true)) |
| 6258 | { | ||
| 6259 | ✗ | return qe_invalid; | |
| 6260 | } | ||
| 6261 | 77 | } | |
| 6262 | |||
| 6263 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version>1) |
| 6264 | { | ||
| 6265 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<items_to_read; i++) |
| 6266 | { | ||
| 6267 | char tempname[64]; | ||
| 6268 | |||
| 6269 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!pfread(tempname, 64, f, keepdata)) |
| 6270 | { | ||
| 6271 | ✗ | return qe_invalid; | |
| 6272 | } | ||
| 6273 | |||
| 6274 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
|
19712 | if(keepdata) |
| 6275 | { | ||
| 6276 | 19712 | strcpy(item_string[i], tempname); | |
| 6277 | 19712 | } | |
| 6278 | 19712 | } | |
| 6279 | 77 | } | |
| 6280 | else | ||
| 6281 | { | ||
| 6282 | ✗ | if(keepdata) | |
| 6283 | { | ||
| 6284 | ✗ | for(int32_t i=0; i<ITEMCNT; i++) | |
| 6285 | { | ||
| 6286 | ✗ | reset_itemname(i); | |
| 6287 | } | ||
| 6288 | } | ||
| 6289 | } | ||
| 6290 | |||
| 6291 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata) |
| 6292 | { | ||
| 6293 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<MAXITEMS; i++) |
| 6294 | { | ||
| 6295 | 19712 | itemdata& id = itemsbuf[i]; | |
| 6296 | 19712 | memset(&id, 0, sizeof(itemdata)); | |
| 6297 | 19712 | id.count=-1; | |
| 6298 | 19712 | id.playsound=WAV_SCALE; | |
| 6299 | 19712 | reset_itembuf(&id,i); | |
| 6300 | 19712 | } | |
| 6301 | 77 | } | |
| 6302 | |||
| 6303 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<items_to_read; i++) |
| 6304 | { | ||
| 6305 | 19712 | memset(&tempitem, 0, sizeof(itemdata)); | |
| 6306 | 19712 | reset_itembuf(&tempitem,i); | |
| 6307 | |||
| 6308 | |||
| 6309 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if ( s_version > 35 ) //expanded tiles |
| 6310 | { | ||
| 6311 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.tile,f,true)) |
| 6312 | { | ||
| 6313 | ✗ | return qe_invalid; | |
| 6314 | } | ||
| 6315 | 2048 | } | |
| 6316 | else | ||
| 6317 | { | ||
| 6318 |
1/2✓ Branch 0 taken 17664 times.
✗ Branch 1 not taken.
|
17664 | if(!p_igetw(&tempitem.tile,f,true)) |
| 6319 | { | ||
| 6320 | ✗ | return qe_invalid; | |
| 6321 | } | ||
| 6322 | } | ||
| 6323 | |||
| 6324 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.misc_flags,f,true)) |
| 6325 | { | ||
| 6326 | ✗ | return qe_invalid; | |
| 6327 | } | ||
| 6328 | |||
| 6329 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.csets,f,true)) |
| 6330 | { | ||
| 6331 | ✗ | return qe_invalid; | |
| 6332 | } | ||
| 6333 | |||
| 6334 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.frames,f,true)) |
| 6335 | { | ||
| 6336 | ✗ | return qe_invalid; | |
| 6337 | } | ||
| 6338 | |||
| 6339 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.speed,f,true)) |
| 6340 | { | ||
| 6341 | ✗ | return qe_invalid; | |
| 6342 | } | ||
| 6343 | |||
| 6344 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.delay,f,true)) |
| 6345 | { | ||
| 6346 | ✗ | return qe_invalid; | |
| 6347 | } | ||
| 6348 | |||
| 6349 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(version < 0x193) |
| 6350 | { | ||
| 6351 | ✗ | if(!p_getc(&padding,f,true)) | |
| 6352 | { | ||
| 6353 | ✗ | return qe_invalid; | |
| 6354 | } | ||
| 6355 | |||
| 6356 | ✗ | if((version < 0x192)||((version == 0x192)&&(build<186))) | |
| 6357 | { | ||
| 6358 | ✗ | switch(i) | |
| 6359 | { | ||
| 6360 | case iShield: | ||
| 6361 | ✗ | tempitem.ltm=get_bit(quest_rules,qr_BSZELDA)?-12:10; | |
| 6362 | ✗ | break; | |
| 6363 | |||
| 6364 | case iMShield: | ||
| 6365 | ✗ | tempitem.ltm=get_bit(quest_rules,qr_BSZELDA)?-6:-10; | |
| 6366 | ✗ | break; | |
| 6367 | |||
| 6368 | default: | ||
| 6369 | ✗ | tempitem.ltm=0; | |
| 6370 | ✗ | break; | |
| 6371 | } | ||
| 6372 | |||
| 6373 | ✗ | tempitem.count=-1; | |
| 6374 | ✗ | tempitem.flags=tempitem.wpn=tempitem.wpn2=tempitem.wpn3=tempitem.wpn3=tempitem.pickup_hearts= | |
| 6375 | ✗ | tempitem.misc1=tempitem.misc2=tempitem.usesound=0; | |
| 6376 | ✗ | tempitem.family=0xFF; | |
| 6377 | ✗ | tempitem.playsound=WAV_SCALE; | |
| 6378 | ✗ | reset_itembuf(&tempitem,i); | |
| 6379 | |||
| 6380 | ✗ | if(keepdata==true) | |
| 6381 | { | ||
| 6382 | ✗ | memcpy(&itemsbuf[i], &tempitem, sizeof(itemdata)); | |
| 6383 | } | ||
| 6384 | |||
| 6385 | ✗ | continue; | |
| 6386 | } | ||
| 6387 | } | ||
| 6388 | |||
| 6389 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_igetl(&tempitem.ltm,f,true)) |
| 6390 | { | ||
| 6391 | ✗ | return qe_invalid; | |
| 6392 | } | ||
| 6393 | |||
| 6394 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(version < 0x193) |
| 6395 | { | ||
| 6396 | ✗ | for(int32_t q=0; q<12; q++) | |
| 6397 | { | ||
| 6398 | ✗ | if(!p_getc(&padding,f,true)) | |
| 6399 | { | ||
| 6400 | ✗ | return qe_invalid; | |
| 6401 | } | ||
| 6402 | } | ||
| 6403 | } | ||
| 6404 | |||
| 6405 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version>1) |
| 6406 | { | ||
| 6407 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if ( s_version >= 31 ) |
| 6408 | { | ||
| 6409 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.family,f,true)) |
| 6410 | { | ||
| 6411 | ✗ | return qe_invalid; | |
| 6412 | } | ||
| 6413 | 2048 | } | |
| 6414 | else | ||
| 6415 | { | ||
| 6416 |
1/2✓ Branch 0 taken 17664 times.
✗ Branch 1 not taken.
|
17664 | if(!p_getc(&tempitem.family,f,true)) |
| 6417 | { | ||
| 6418 | ✗ | return qe_invalid; | |
| 6419 | } | ||
| 6420 | } | ||
| 6421 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version < 16) |
| 6422 | ✗ | if(tempitem.family == 0xFF) | |
| 6423 | ✗ | tempitem.family = itype_misc; | |
| 6424 | |||
| 6425 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.fam_type,f,true)) |
| 6426 | { | ||
| 6427 | ✗ | return qe_invalid; | |
| 6428 | } | ||
| 6429 | |||
| 6430 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version>5) |
| 6431 | { | ||
| 6432 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if(s_version>=31) |
| 6433 | { | ||
| 6434 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.power,f,true)) |
| 6435 | { | ||
| 6436 | ✗ | return qe_invalid; | |
| 6437 | } | ||
| 6438 | 2048 | } | |
| 6439 | else | ||
| 6440 | { | ||
| 6441 |
1/2✓ Branch 0 taken 17664 times.
✗ Branch 1 not taken.
|
17664 | if(!p_getc(&tempitem.power,f,true)) |
| 6442 | { | ||
| 6443 | ✗ | return qe_invalid; | |
| 6444 | } | ||
| 6445 | } | ||
| 6446 | |||
| 6447 | //converted flags from 16b to 32b -Z | ||
| 6448 |
2/2✓ Branch 0 taken 17664 times.
✓ Branch 1 taken 2048 times.
|
19712 | if ( s_version < 41 ) |
| 6449 | { | ||
| 6450 |
1/2✓ Branch 0 taken 17664 times.
✗ Branch 1 not taken.
|
17664 | if(!p_igetw(&tempitem.flags,f,true)) |
| 6451 | { | ||
| 6452 | ✗ | return qe_invalid; | |
| 6453 | } | ||
| 6454 | 17664 | } | |
| 6455 | else | ||
| 6456 | { | ||
| 6457 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.flags,f,true)) |
| 6458 | { | ||
| 6459 | ✗ | return qe_invalid; | |
| 6460 | } | ||
| 6461 | } | ||
| 6462 | 19712 | } | |
| 6463 | else | ||
| 6464 | { | ||
| 6465 | //tempitem.power = tempitem.fam_type; | ||
| 6466 | char tempchar; | ||
| 6467 | |||
| 6468 | ✗ | if(!p_getc(&tempchar,f,true)) | |
| 6469 | { | ||
| 6470 | ✗ | return qe_invalid; | |
| 6471 | } | ||
| 6472 | |||
| 6473 | ✗ | tempitem.flags |= (tempchar ? ITEM_GAMEDATA : 0); | |
| 6474 | } | ||
| 6475 | |||
| 6476 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_igetw(&tempitem.script,f,true)) |
| 6477 | { | ||
| 6478 | ✗ | return qe_invalid; | |
| 6479 | } | ||
| 6480 | |||
| 6481 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version<=3) |
| 6482 | { | ||
| 6483 | ✗ | if(tempitem.script > NUMSCRIPTITEM) | |
| 6484 | { | ||
| 6485 | ✗ | tempitem.script = 0; | |
| 6486 | } | ||
| 6487 | } | ||
| 6488 | |||
| 6489 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.count,f,true)) |
| 6490 | { | ||
| 6491 | ✗ | return qe_invalid; | |
| 6492 | } | ||
| 6493 | |||
| 6494 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_igetw(&tempitem.amount,f,true)) |
| 6495 | { | ||
| 6496 | ✗ | return qe_invalid; | |
| 6497 | } | ||
| 6498 | |||
| 6499 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_igetw(&tempitem.collect_script,f,true)) |
| 6500 | { | ||
| 6501 | ✗ | return qe_invalid; | |
| 6502 | } | ||
| 6503 | |||
| 6504 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version<=3) |
| 6505 | { | ||
| 6506 | ✗ | if(tempitem.collect_script > NUMSCRIPTITEM) | |
| 6507 | { | ||
| 6508 | ✗ | tempitem.collect_script = 0; | |
| 6509 | } | ||
| 6510 | } | ||
| 6511 | |||
| 6512 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_igetw(&tempitem.setmax,f,true)) |
| 6513 | { | ||
| 6514 | ✗ | return qe_invalid; | |
| 6515 | } | ||
| 6516 | |||
| 6517 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_igetw(&tempitem.max,f,true)) |
| 6518 | { | ||
| 6519 | ✗ | return qe_invalid; | |
| 6520 | } | ||
| 6521 | |||
| 6522 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.playsound,f,true)) |
| 6523 | { | ||
| 6524 | ✗ | return qe_invalid; | |
| 6525 | } | ||
| 6526 | |||
| 6527 |
2/2✓ Branch 0 taken 157696 times.
✓ Branch 1 taken 19712 times.
|
177408 | for(int32_t j=0; j<8; j++) |
| 6528 | { | ||
| 6529 |
1/2✓ Branch 0 taken 157696 times.
✗ Branch 1 not taken.
|
157696 | if(!p_igetl(&tempitem.initiald[j],f,true)) |
| 6530 | { | ||
| 6531 | ✗ | return qe_invalid; | |
| 6532 | } | ||
| 6533 | 157696 | } | |
| 6534 | |||
| 6535 |
2/2✓ Branch 0 taken 39424 times.
✓ Branch 1 taken 19712 times.
|
59136 | for(int32_t j=0; j<2; j++) |
| 6536 | { | ||
| 6537 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&tempitem.initiala[j],f,true)) |
| 6538 | { | ||
| 6539 | ✗ | return qe_invalid; | |
| 6540 | } | ||
| 6541 | 39424 | } | |
| 6542 | |||
| 6543 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
|
19712 | if(s_version>4) |
| 6544 | { | ||
| 6545 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version>5) |
| 6546 | { | ||
| 6547 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.wpn,f,true)) |
| 6548 | { | ||
| 6549 | ✗ | return qe_invalid; | |
| 6550 | } | ||
| 6551 | |||
| 6552 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.wpn2,f,true)) |
| 6553 | { | ||
| 6554 | ✗ | return qe_invalid; | |
| 6555 | } | ||
| 6556 | |||
| 6557 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.wpn3,f,true)) |
| 6558 | { | ||
| 6559 | ✗ | return qe_invalid; | |
| 6560 | } | ||
| 6561 | |||
| 6562 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.wpn4,f,true)) |
| 6563 | { | ||
| 6564 | ✗ | return qe_invalid; | |
| 6565 | } | ||
| 6566 | |||
| 6567 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
|
19712 | if(s_version>=15) |
| 6568 | { | ||
| 6569 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.wpn5,f,true)) |
| 6570 | { | ||
| 6571 | ✗ | return qe_invalid; | |
| 6572 | } | ||
| 6573 | |||
| 6574 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.wpn6,f,true)) |
| 6575 | { | ||
| 6576 | ✗ | return qe_invalid; | |
| 6577 | } | ||
| 6578 | |||
| 6579 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.wpn7,f,true)) |
| 6580 | { | ||
| 6581 | ✗ | return qe_invalid; | |
| 6582 | } | ||
| 6583 | |||
| 6584 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.wpn8,f,true)) |
| 6585 | { | ||
| 6586 | ✗ | return qe_invalid; | |
| 6587 | } | ||
| 6588 | |||
| 6589 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.wpn9,f,true)) |
| 6590 | { | ||
| 6591 | ✗ | return qe_invalid; | |
| 6592 | } | ||
| 6593 | |||
| 6594 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.wpn10,f,true)) |
| 6595 | { | ||
| 6596 | ✗ | return qe_invalid; | |
| 6597 | } | ||
| 6598 | 19712 | } | |
| 6599 | |||
| 6600 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.pickup_hearts,f,true)) |
| 6601 | { | ||
| 6602 | ✗ | return qe_invalid; | |
| 6603 | } | ||
| 6604 | |||
| 6605 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
|
19712 | if(s_version<15) |
| 6606 | { | ||
| 6607 | ✗ | if(!p_igetw(&dummy_word,f,true)) | |
| 6608 | { | ||
| 6609 | ✗ | return qe_invalid; | |
| 6610 | } | ||
| 6611 | |||
| 6612 | ✗ | tempitem.misc1=dummy_word; | |
| 6613 | |||
| 6614 | ✗ | if(!p_igetw(&dummy_word,f,true)) | |
| 6615 | { | ||
| 6616 | ✗ | return qe_invalid; | |
| 6617 | } | ||
| 6618 | |||
| 6619 | ✗ | tempitem.misc2=dummy_word; | |
| 6620 | } | ||
| 6621 | else | ||
| 6622 | { | ||
| 6623 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_igetl(&tempitem.misc1,f,true)) |
| 6624 | { | ||
| 6625 | ✗ | return qe_invalid; | |
| 6626 | } | ||
| 6627 | |||
| 6628 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_igetl(&tempitem.misc2,f,true)) |
| 6629 | { | ||
| 6630 | ✗ | return qe_invalid; | |
| 6631 | } | ||
| 6632 | |||
| 6633 | // Version 24: shICE -> shSCRIPT; previously, all shields could block script weapons | ||
| 6634 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version<24) |
| 6635 | { | ||
| 6636 | ✗ | if(tempitem.family==itype_shield) | |
| 6637 | { | ||
| 6638 | ✗ | tempitem.misc1|=shSCRIPT; | |
| 6639 | } | ||
| 6640 | } | ||
| 6641 | } | ||
| 6642 | |||
| 6643 |
2/2✓ Branch 0 taken 17664 times.
✓ Branch 1 taken 2048 times.
|
19712 | if(s_version < 53) |
| 6644 | { | ||
| 6645 | byte tempbyte; | ||
| 6646 |
1/2✓ Branch 0 taken 17664 times.
✗ Branch 1 not taken.
|
17664 | if(!p_getc(&tempbyte,f,true)) |
| 6647 | { | ||
| 6648 | ✗ | return qe_invalid; | |
| 6649 | } | ||
| 6650 | 17664 | tempitem.cost_amount[0] = tempbyte; | |
| 6651 | 17664 | } | |
| 6652 | else | ||
| 6653 | { | ||
| 6654 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 2048 times.
|
6144 | for(auto q = 0; q < 2; ++q) |
| 6655 | { | ||
| 6656 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetw(&tempitem.cost_amount[q],f,true)) |
| 6657 | { | ||
| 6658 | ✗ | return qe_invalid; | |
| 6659 | } | ||
| 6660 | 4096 | } | |
| 6661 | } | ||
| 6662 | 19712 | } | |
| 6663 | else | ||
| 6664 | { | ||
| 6665 | char tempchar; | ||
| 6666 | |||
| 6667 | ✗ | if(!p_getc(&tempchar,f,true)) | |
| 6668 | { | ||
| 6669 | ✗ | return qe_invalid; | |
| 6670 | } | ||
| 6671 | |||
| 6672 | ✗ | tempitem.flags |= (tempchar ? ITEM_EDIBLE : 0); | |
| 6673 | } | ||
| 6674 | |||
| 6675 | // June 2007: more misc. attributes | ||
| 6676 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
|
19712 | if(s_version>=12) |
| 6677 | { | ||
| 6678 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
|
19712 | if(s_version<15) |
| 6679 | { | ||
| 6680 | ✗ | if(!p_igetw(&dummy_word,f,true)) | |
| 6681 | { | ||
| 6682 | ✗ | return qe_invalid; | |
| 6683 | } | ||
| 6684 | |||
| 6685 | ✗ | tempitem.misc3=dummy_word; | |
| 6686 | |||
| 6687 | ✗ | if(!p_igetw(&dummy_word,f,true)) | |
| 6688 | { | ||
| 6689 | ✗ | return qe_invalid; | |
| 6690 | } | ||
| 6691 | |||
| 6692 | ✗ | tempitem.misc4=dummy_word; | |
| 6693 | } | ||
| 6694 | else | ||
| 6695 | { | ||
| 6696 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_igetl(&tempitem.misc3,f,true)) |
| 6697 | { | ||
| 6698 | ✗ | return qe_invalid; | |
| 6699 | } | ||
| 6700 | |||
| 6701 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_igetl(&tempitem.misc4,f,true)) |
| 6702 | { | ||
| 6703 | ✗ | return qe_invalid; | |
| 6704 | } | ||
| 6705 | |||
| 6706 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_igetl(&tempitem.misc5,f,true)) |
| 6707 | { | ||
| 6708 | ✗ | return qe_invalid; | |
| 6709 | } | ||
| 6710 | |||
| 6711 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_igetl(&tempitem.misc6,f,true)) |
| 6712 | { | ||
| 6713 | ✗ | return qe_invalid; | |
| 6714 | } | ||
| 6715 | |||
| 6716 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_igetl(&tempitem.misc7,f,true)) |
| 6717 | { | ||
| 6718 | ✗ | return qe_invalid; | |
| 6719 | } | ||
| 6720 | |||
| 6721 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_igetl(&tempitem.misc8,f,true)) |
| 6722 | { | ||
| 6723 | ✗ | return qe_invalid; | |
| 6724 | } | ||
| 6725 | |||
| 6726 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_igetl(&tempitem.misc9,f,true)) |
| 6727 | { | ||
| 6728 | ✗ | return qe_invalid; | |
| 6729 | } | ||
| 6730 | |||
| 6731 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_igetl(&tempitem.misc10,f,true)) |
| 6732 | { | ||
| 6733 | ✗ | return qe_invalid; | |
| 6734 | } | ||
| 6735 | } | ||
| 6736 | |||
| 6737 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempitem.usesound,f,true)) |
| 6738 | { | ||
| 6739 | ✗ | return qe_invalid; | |
| 6740 | } | ||
| 6741 | |||
| 6742 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if(s_version >= 49) |
| 6743 | { | ||
| 6744 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_getc(&tempitem.usesound2,f,true)) |
| 6745 | { | ||
| 6746 | ✗ | return qe_invalid; | |
| 6747 | } | ||
| 6748 | 2048 | } | |
| 6749 | 17664 | else tempitem.usesound2 = 0; | |
| 6750 | |||
| 6751 |
3/4✓ Branch 0 taken 17664 times.
✓ Branch 1 taken 2048 times.
✓ Branch 2 taken 17664 times.
✗ Branch 3 not taken.
|
19712 | if(s_version < 50 && tempitem.family == itype_mirror) |
| 6752 | { | ||
| 6753 | //Split continue/dmap warp effect/sfx, port for old | ||
| 6754 | ✗ | tempitem.misc2 = tempitem.misc1; | |
| 6755 | ✗ | tempitem.usesound2 = tempitem.usesound; | |
| 6756 | } | ||
| 6757 | 19712 | } | |
| 6758 | 19712 | } | |
| 6759 | |||
| 6760 |
2/2✓ Branch 0 taken 17664 times.
✓ Branch 1 taken 2048 times.
|
19712 | if ( s_version >= 26 ) //! New itemdata vars for weapon editor. -Z |
| 6761 | { // temp.useweapon, temp.usedefence, temp.weaprange, temp.weap_pattern[ITEM_MOVEMENT_PATTERNS] | ||
| 6762 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_getc(&tempitem.useweapon,f,true)) |
| 6763 | { | ||
| 6764 | ✗ | return qe_invalid; | |
| 6765 | } | ||
| 6766 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_getc(&tempitem.usedefence,f,true)) |
| 6767 | { | ||
| 6768 | ✗ | return qe_invalid; | |
| 6769 | } | ||
| 6770 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.weaprange,f,true)) |
| 6771 | { | ||
| 6772 | ✗ | return qe_invalid; | |
| 6773 | } | ||
| 6774 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.weapduration,f,true)) |
| 6775 | { | ||
| 6776 | ✗ | return qe_invalid; | |
| 6777 | } | ||
| 6778 |
2/2✓ Branch 0 taken 20480 times.
✓ Branch 1 taken 2048 times.
|
22528 | for ( int32_t q = 0; q < ITEM_MOVEMENT_PATTERNS; q++ ) |
| 6779 | { | ||
| 6780 |
1/2✓ Branch 0 taken 20480 times.
✗ Branch 1 not taken.
|
20480 | if(!p_igetl(&tempitem.weap_pattern[q],f,true)) |
| 6781 | { | ||
| 6782 | ✗ | return qe_invalid; | |
| 6783 | } | ||
| 6784 | 20480 | } | |
| 6785 | 2048 | } | |
| 6786 | |||
| 6787 |
2/2✓ Branch 0 taken 17664 times.
✓ Branch 1 taken 2048 times.
|
19712 | if ( s_version >= 27 ) //! New itemdata vars for weapon editor. -Z |
| 6788 | { // temp.useweapon, temp.usedefence, temp.weaprange, temp.weap_pattern[ITEM_MOVEMENT_PATTERNS] | ||
| 6789 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.duplicates,f,true)) |
| 6790 | { | ||
| 6791 | ✗ | return qe_invalid; | |
| 6792 | } | ||
| 6793 |
2/2✓ Branch 0 taken 16384 times.
✓ Branch 1 taken 2048 times.
|
18432 | for ( int32_t q = 0; q < INITIAL_D; q++ ) |
| 6794 | { | ||
| 6795 |
1/2✓ Branch 0 taken 16384 times.
✗ Branch 1 not taken.
|
16384 | if(!p_igetl(&tempitem.weap_initiald[q],f,true)) |
| 6796 | { | ||
| 6797 | ✗ | return qe_invalid; | |
| 6798 | } | ||
| 6799 | 16384 | } | |
| 6800 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 2048 times.
|
6144 | for ( int32_t q = 0; q < INITIAL_A; q++ ) |
| 6801 | { | ||
| 6802 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_getc(&tempitem.weap_initiala[q],f,true)) |
| 6803 | { | ||
| 6804 | ✗ | return qe_invalid; | |
| 6805 | } | ||
| 6806 | 4096 | } | |
| 6807 | |||
| 6808 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_getc(&tempitem.drawlayer,f,true)) |
| 6809 | { | ||
| 6810 | ✗ | return qe_invalid; | |
| 6811 | } | ||
| 6812 | |||
| 6813 | |||
| 6814 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.hxofs,f,true)) |
| 6815 | { | ||
| 6816 | ✗ | return qe_invalid; | |
| 6817 | } | ||
| 6818 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.hyofs,f,true)) |
| 6819 | { | ||
| 6820 | ✗ | return qe_invalid; | |
| 6821 | } | ||
| 6822 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.hxsz,f,true)) |
| 6823 | { | ||
| 6824 | ✗ | return qe_invalid; | |
| 6825 | } | ||
| 6826 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.hysz,f,true)) |
| 6827 | { | ||
| 6828 | ✗ | return qe_invalid; | |
| 6829 | } | ||
| 6830 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.hzsz,f,true)) |
| 6831 | { | ||
| 6832 | ✗ | return qe_invalid; | |
| 6833 | } | ||
| 6834 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.xofs,f,true)) |
| 6835 | { | ||
| 6836 | ✗ | return qe_invalid; | |
| 6837 | } | ||
| 6838 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.yofs,f,true)) |
| 6839 | { | ||
| 6840 | ✗ | return qe_invalid; | |
| 6841 | } | ||
| 6842 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.weap_hxofs,f,true)) |
| 6843 | { | ||
| 6844 | ✗ | return qe_invalid; | |
| 6845 | } | ||
| 6846 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.weap_hyofs,f,true)) |
| 6847 | { | ||
| 6848 | ✗ | return qe_invalid; | |
| 6849 | } | ||
| 6850 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.weap_hxsz,f,true)) |
| 6851 | { | ||
| 6852 | ✗ | return qe_invalid; | |
| 6853 | } | ||
| 6854 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.weap_hysz,f,true)) |
| 6855 | { | ||
| 6856 | ✗ | return qe_invalid; | |
| 6857 | } | ||
| 6858 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.weap_hzsz,f,true)) |
| 6859 | { | ||
| 6860 | ✗ | return qe_invalid; | |
| 6861 | } | ||
| 6862 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.weap_xofs,f,true)) |
| 6863 | { | ||
| 6864 | ✗ | return qe_invalid; | |
| 6865 | } | ||
| 6866 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.weap_yofs,f,true)) |
| 6867 | { | ||
| 6868 | ✗ | return qe_invalid; | |
| 6869 | } | ||
| 6870 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetw(&tempitem.weaponscript,f,true)) |
| 6871 | { | ||
| 6872 | ✗ | return qe_invalid; | |
| 6873 | } | ||
| 6874 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.wpnsprite,f,true)) |
| 6875 | { | ||
| 6876 | ✗ | return qe_invalid; | |
| 6877 | } | ||
| 6878 | 2048 | auto num_cost_tmr = (s_version > 52 ? 2 : 1); | |
| 6879 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 2048 times.
|
6144 | for(auto q = 0; q < num_cost_tmr; ++q) |
| 6880 | { | ||
| 6881 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&tempitem.magiccosttimer[q],f,true)) |
| 6882 | { | ||
| 6883 | ✗ | return qe_invalid; | |
| 6884 | } | ||
| 6885 | 4096 | } | |
| 6886 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2048 times.
|
2048 | for(auto q = num_cost_tmr; q < 2; ++q) |
| 6887 | ✗ | tempitem.magiccosttimer[q] = 0; | |
| 6888 | 2048 | } | |
| 6889 |
2/2✓ Branch 0 taken 17664 times.
✓ Branch 1 taken 2048 times.
|
19712 | if ( s_version >= 28 ) //! New itemdata vars for weapon editor. -Z |
| 6890 | { | ||
| 6891 | //Item Size FLags, TileWidth, TileHeight | ||
| 6892 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.overrideFLAGS,f,true)) |
| 6893 | { | ||
| 6894 | ✗ | return qe_invalid; | |
| 6895 | } | ||
| 6896 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.tilew,f,true)) |
| 6897 | { | ||
| 6898 | ✗ | return qe_invalid; | |
| 6899 | } | ||
| 6900 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.tileh,f,true)) |
| 6901 | { | ||
| 6902 | ✗ | return qe_invalid; | |
| 6903 | } | ||
| 6904 | 2048 | } | |
| 6905 |
2/2✓ Branch 0 taken 17664 times.
✓ Branch 1 taken 2048 times.
|
19712 | if ( s_version >= 29 ) //! More new vars. |
| 6906 | { | ||
| 6907 | //Item Size FLags, TileWidth, TileHeight | ||
| 6908 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.weapoverrideFLAGS,f,true)) |
| 6909 | { | ||
| 6910 | ✗ | return qe_invalid; | |
| 6911 | } | ||
| 6912 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.weap_tilew,f,true)) |
| 6913 | { | ||
| 6914 | ✗ | return qe_invalid; | |
| 6915 | } | ||
| 6916 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.weap_tileh,f,true)) |
| 6917 | { | ||
| 6918 | ✗ | return qe_invalid; | |
| 6919 | } | ||
| 6920 | 2048 | } | |
| 6921 |
2/2✓ Branch 0 taken 17664 times.
✓ Branch 1 taken 2048 times.
|
19712 | if ( s_version >= 30 ) //! More new vars. |
| 6922 | { | ||
| 6923 | //Pickup Type | ||
| 6924 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempitem.pickup,f,true)) |
| 6925 | { | ||
| 6926 | ✗ | return qe_invalid; | |
| 6927 | } | ||
| 6928 | 2048 | } | |
| 6929 |
2/2✓ Branch 0 taken 17664 times.
✓ Branch 1 taken 2048 times.
|
19712 | if ( s_version >= 32 ) //! More new vars. |
| 6930 | { | ||
| 6931 | //Pickup Type | ||
| 6932 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetw(&tempitem.pstring,f,true)) |
| 6933 | { | ||
| 6934 | ✗ | return qe_invalid; | |
| 6935 | } | ||
| 6936 | 2048 | } | |
| 6937 |
2/2✓ Branch 0 taken 17664 times.
✓ Branch 1 taken 2048 times.
|
19712 | if ( s_version >= 33 ) //! More new vars. |
| 6938 | { | ||
| 6939 | //Pickup Type | ||
| 6940 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetw(&tempitem.pickup_string_flags,f,true)) |
| 6941 | { | ||
| 6942 | ✗ | return qe_invalid; | |
| 6943 | } | ||
| 6944 | 2048 | } | |
| 6945 |
2/2✓ Branch 0 taken 17664 times.
✓ Branch 1 taken 2048 times.
|
19712 | if ( s_version >= 34 ) //! cost counter |
| 6946 | { | ||
| 6947 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2048 times.
|
2048 | if(s_version < 53) |
| 6948 | { | ||
| 6949 | ✗ | if(!p_getc(&tempitem.cost_counter[0],f,true)) | |
| 6950 | { | ||
| 6951 | ✗ | return qe_invalid; | |
| 6952 | } | ||
| 6953 | } | ||
| 6954 | else | ||
| 6955 | { | ||
| 6956 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 2048 times.
|
6144 | for(auto q = 0; q < 2; ++q) |
| 6957 | { | ||
| 6958 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_getc(&tempitem.cost_counter[q],f,true)) |
| 6959 | { | ||
| 6960 | ✗ | return qe_invalid; | |
| 6961 | } | ||
| 6962 | 4096 | } | |
| 6963 | } | ||
| 6964 | 2048 | } | |
| 6965 |
2/2✓ Branch 0 taken 17664 times.
✓ Branch 1 taken 2048 times.
|
19712 | if ( s_version >= 44 ) //! sprite scripts |
| 6966 | { | ||
| 6967 |
2/2✓ Branch 0 taken 16384 times.
✓ Branch 1 taken 2048 times.
|
18432 | for ( int32_t q = 0; q < 8; q++ ) |
| 6968 | { | ||
| 6969 |
2/2✓ Branch 0 taken 1064960 times.
✓ Branch 1 taken 16384 times.
|
1081344 | for ( int32_t w = 0; w < 65; w++ ) |
| 6970 | { | ||
| 6971 |
1/2✓ Branch 0 taken 1064960 times.
✗ Branch 1 not taken.
|
1064960 | if(!p_getc(&(tempitem.initD_label[q][w]),f,keepdata)) |
| 6972 | { | ||
| 6973 | ✗ | return qe_invalid; | |
| 6974 | } | ||
| 6975 | 1064960 | } | |
| 6976 |
2/2✓ Branch 0 taken 1064960 times.
✓ Branch 1 taken 16384 times.
|
1081344 | for ( int32_t w = 0; w < 65; w++ ) |
| 6977 | { | ||
| 6978 |
1/2✓ Branch 0 taken 1064960 times.
✗ Branch 1 not taken.
|
1064960 | if(!p_getc(&(tempitem.weapon_initD_label[q][w]),f,keepdata)) |
| 6979 | { | ||
| 6980 | ✗ | return qe_invalid; | |
| 6981 | } | ||
| 6982 | 1064960 | } | |
| 6983 |
2/2✓ Branch 0 taken 1064960 times.
✓ Branch 1 taken 16384 times.
|
1081344 | for ( int32_t w = 0; w < 65; w++ ) |
| 6984 | { | ||
| 6985 |
1/2✓ Branch 0 taken 1064960 times.
✗ Branch 1 not taken.
|
1064960 | if(!p_getc(&(tempitem.sprite_initD_label[q][w]),f,keepdata)) |
| 6986 | { | ||
| 6987 | ✗ | return qe_invalid; | |
| 6988 | } | ||
| 6989 | 1064960 | } | |
| 6990 |
1/2✓ Branch 0 taken 16384 times.
✗ Branch 1 not taken.
|
16384 | if(!p_igetl(&(tempitem.sprite_initiald[q]),f,keepdata)) |
| 6991 | { | ||
| 6992 | ✗ | return qe_invalid; | |
| 6993 | } | ||
| 6994 | |||
| 6995 | 16384 | } | |
| 6996 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 2048 times.
|
6144 | for ( int32_t q = 0; q < 2; q++ ) |
| 6997 | { | ||
| 6998 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_getc(&(tempitem.sprite_initiala[q]),f,keepdata)) |
| 6999 | { | ||
| 7000 | ✗ | return qe_invalid; | |
| 7001 | } | ||
| 7002 | 4096 | } | |
| 7003 | //Pickup Type | ||
| 7004 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetw(&tempitem.sprite_script,f,true)) |
| 7005 | { | ||
| 7006 | ✗ | return qe_invalid; | |
| 7007 | } | ||
| 7008 | 2048 | } | |
| 7009 |
2/2✓ Branch 0 taken 17664 times.
✓ Branch 1 taken 2048 times.
|
19712 | if ( s_version >= 48 ) //! pickup flags |
| 7010 | { | ||
| 7011 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_getc(&(tempitem.pickupflag),f,keepdata)) |
| 7012 | { | ||
| 7013 | ✗ | return qe_invalid; | |
| 7014 | } | ||
| 7015 | 2048 | } | |
| 7016 | 19712 | } | |
| 7017 | else | ||
| 7018 | { | ||
| 7019 | ✗ | tempitem.count=-1; | |
| 7020 | ✗ | tempitem.family=itype_misc; | |
| 7021 | ✗ | tempitem.flags=tempitem.wpn=tempitem.wpn2=tempitem.wpn3=tempitem.wpn3=tempitem.pickup_hearts=tempitem.misc1=tempitem.misc2=tempitem.usesound=0; | |
| 7022 | ✗ | tempitem.playsound=WAV_SCALE; | |
| 7023 | ✗ | reset_itembuf(&tempitem,i); | |
| 7024 | } | ||
| 7025 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if(s_version < 53) |
| 7026 | { | ||
| 7027 |
4/4✓ Branch 0 taken 17304 times.
✓ Branch 1 taken 207 times.
✓ Branch 2 taken 84 times.
✓ Branch 3 taken 69 times.
|
17664 | switch(tempitem.family) |
| 7028 | { | ||
| 7029 | case itype_arrow: | ||
| 7030 | 207 | tempitem.cost_counter[1] = crARROWS; | |
| 7031 | 207 | tempitem.cost_amount[1] = 1; | |
| 7032 | 207 | break; | |
| 7033 | case itype_bomb: | ||
| 7034 | 84 | tempitem.cost_counter[1] = crBOMBS; | |
| 7035 | 84 | tempitem.cost_amount[1] = 1; | |
| 7036 | 84 | break; | |
| 7037 | case itype_sbomb: | ||
| 7038 | 69 | tempitem.cost_counter[1] = crSBOMBS; | |
| 7039 | 69 | tempitem.cost_amount[1] = 1; | |
| 7040 | 69 | break; | |
| 7041 | default: | ||
| 7042 | 17304 | tempitem.cost_counter[1] = crNONE; | |
| 7043 | 17304 | tempitem.cost_amount[1] = 0; | |
| 7044 | 17304 | } | |
| 7045 | 17664 | tempitem.magiccosttimer[1] = 0; | |
| 7046 | 17664 | } | |
| 7047 | |||
| 7048 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(keepdata==true) |
| 7049 | { | ||
| 7050 | 19712 | memcpy(&itemsbuf[i], &tempitem, sizeof(itemdata)); | |
| 7051 | 19712 | } | |
| 7052 | ✗ | else if(zgpmode) | |
| 7053 | { | ||
| 7054 | ✗ | itemsbuf[i].tile=tempitem.tile; | |
| 7055 | ✗ | itemsbuf[i].misc_flags=tempitem.misc_flags; | |
| 7056 | ✗ | itemsbuf[i].csets=tempitem.csets; | |
| 7057 | ✗ | itemsbuf[i].frames=tempitem.frames; | |
| 7058 | ✗ | itemsbuf[i].speed=tempitem.speed; | |
| 7059 | ✗ | itemsbuf[i].delay=tempitem.delay; | |
| 7060 | ✗ | itemsbuf[i].ltm=tempitem.ltm; | |
| 7061 | } | ||
| 7062 | 19712 | } | |
| 7063 | |||
| 7064 | ////////////////////////////////////////////////////// | ||
| 7065 | // Now do any updates because of new item additions | ||
| 7066 | // (These can't be done above because items_to_read | ||
| 7067 | // might be too low.) | ||
| 7068 | ////////////////////////////////////////////////////// | ||
| 7069 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata==true) |
| 7070 | { | ||
| 7071 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<MAXITEMS; i++) |
| 7072 | { | ||
| 7073 | 19712 | memcpy(&tempitem, &itemsbuf[i], sizeof(itemdata)); | |
| 7074 | |||
| 7075 | //Account for older quests that didn't have an actual item for the used letter | ||
| 7076 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
19712 | if(s_version < 2 && i==iLetterUsed) |
| 7077 | { | ||
| 7078 | ✗ | reset_itembuf(&tempitem, iLetterUsed); | |
| 7079 | ✗ | strcpy(item_string[i],old_item_string[i]); | |
| 7080 | ✗ | tempitem.tile = itemsbuf[iLetter].tile; | |
| 7081 | ✗ | tempitem.csets = itemsbuf[iLetter].csets; | |
| 7082 | ✗ | tempitem.misc_flags = itemsbuf[iLetter].misc_flags; | |
| 7083 | ✗ | tempitem.frames = itemsbuf[iLetter].frames; | |
| 7084 | ✗ | tempitem.speed = itemsbuf[iLetter].speed; | |
| 7085 | ✗ | tempitem.ltm = itemsbuf[iLetter].ltm; | |
| 7086 | } | ||
| 7087 | |||
| 7088 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version < 3) |
| 7089 | { | ||
| 7090 | ✗ | switch(i) | |
| 7091 | { | ||
| 7092 | case iRocsFeather: | ||
| 7093 | case iHoverBoots: | ||
| 7094 | case iSpinScroll: | ||
| 7095 | case iL2SpinScroll: | ||
| 7096 | case iCrossScroll: | ||
| 7097 | case iQuakeScroll: | ||
| 7098 | case iL2QuakeScroll: | ||
| 7099 | case iWhispRing: | ||
| 7100 | case iL2WhispRing: | ||
| 7101 | case iChargeRing: | ||
| 7102 | case iL2ChargeRing: | ||
| 7103 | case iPerilScroll: | ||
| 7104 | case iWalletL3: | ||
| 7105 | case iQuiverL4: | ||
| 7106 | case iBombBagL4: | ||
| 7107 | case iBracelet: | ||
| 7108 | case iL2Bracelet: | ||
| 7109 | case iOldGlove: | ||
| 7110 | case iL2Ladder: | ||
| 7111 | case iWealthMedal: | ||
| 7112 | case iL2WealthMedal: | ||
| 7113 | case iL3WealthMedal: | ||
| 7114 | ✗ | reset_itembuf(&tempitem, i); | |
| 7115 | ✗ | strcpy(item_string[i],old_item_string[i]); | |
| 7116 | ✗ | break; | |
| 7117 | |||
| 7118 | case iSShield: | ||
| 7119 | ✗ | reset_itembuf(&tempitem, i); | |
| 7120 | ✗ | strcpy(item_string[i],old_item_string[i]); | |
| 7121 | ✗ | strcpy(item_string[iShield],old_item_string[iShield]); | |
| 7122 | ✗ | strcpy(item_string[iMShield],old_item_string[iMShield]); | |
| 7123 | ✗ | break; | |
| 7124 | } | ||
| 7125 | } | ||
| 7126 | |||
| 7127 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version < 5) |
| 7128 | { | ||
| 7129 | ✗ | switch(i) | |
| 7130 | { | ||
| 7131 | case iHeartRing: | ||
| 7132 | case iL2HeartRing: | ||
| 7133 | case iL3HeartRing: | ||
| 7134 | case iMagicRing: | ||
| 7135 | case iL2MagicRing: | ||
| 7136 | case iL3MagicRing: | ||
| 7137 | case iL4MagicRing: | ||
| 7138 | ✗ | reset_itembuf(&tempitem, i); | |
| 7139 | ✗ | strcpy(item_string[i],old_item_string[i]); | |
| 7140 | ✗ | break; | |
| 7141 | } | ||
| 7142 | } | ||
| 7143 | |||
| 7144 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version < 6) // April 2007: Advanced item editing capabilities. |
| 7145 | { | ||
| 7146 | ✗ | if(i!=iBPotion && i!=iRPotion) | |
| 7147 | ✗ | tempitem.flags |= get_bit(deprecated_rules,32) ? ITEM_KEEPOLD : 0; | |
| 7148 | |||
| 7149 | ✗ | switch(i) | |
| 7150 | { | ||
| 7151 | case iTriforce: | ||
| 7152 | ✗ | tempitem.fam_type=1; | |
| 7153 | ✗ | break; | |
| 7154 | |||
| 7155 | case iBigTri: | ||
| 7156 | ✗ | tempitem.fam_type=0; | |
| 7157 | ✗ | break; | |
| 7158 | |||
| 7159 | case iBombs: | ||
| 7160 | ✗ | tempitem.fam_type=i_bomb; | |
| 7161 | ✗ | tempitem.power=4; | |
| 7162 | ✗ | tempitem.wpn=wBOMB; | |
| 7163 | ✗ | tempitem.wpn2=wBOOM; | |
| 7164 | ✗ | tempitem.misc1 = 50; | |
| 7165 | |||
| 7166 | ✗ | if(get_bit(deprecated_rules,116)) tempitem.misc1 = 200; //qr_SLOWBOMBFUSES | |
| 7167 | |||
| 7168 | ✗ | break; | |
| 7169 | |||
| 7170 | case iSBomb: | ||
| 7171 | ✗ | tempitem.fam_type=i_sbomb; | |
| 7172 | ✗ | tempitem.power=16; | |
| 7173 | ✗ | tempitem.wpn=wSBOMB; | |
| 7174 | ✗ | tempitem.wpn2=wSBOOM; | |
| 7175 | ✗ | tempitem.misc1 = 50; | |
| 7176 | |||
| 7177 | ✗ | if(get_bit(deprecated_rules,116)) tempitem.misc1 = 400; //qr_SLOWBOMBFUSES | |
| 7178 | |||
| 7179 | ✗ | break; | |
| 7180 | |||
| 7181 | case iBook: | ||
| 7182 | ✗ | if(get_bit(deprecated_rules, 113)) | |
| 7183 | ✗ | tempitem.wpn = wFIREMAGIC; //qr_FIREMAGICSPRITE | |
| 7184 | |||
| 7185 | ✗ | break; | |
| 7186 | |||
| 7187 | case iSArrow: | ||
| 7188 | ✗ | tempitem.wpn2 = get_bit(deprecated_rules,27) ? wSSPARKLE : 0; //qr_SASPARKLES | |
| 7189 | ✗ | tempitem.power=4; | |
| 7190 | ✗ | tempitem.flags|=ITEM_GAMEDATA; | |
| 7191 | ✗ | tempitem.wpn=wSARROW; | |
| 7192 | ✗ | break; | |
| 7193 | |||
| 7194 | case iGArrow: | ||
| 7195 | ✗ | tempitem.wpn2 = get_bit(deprecated_rules,28) ? wGSPARKLE : 0; //qr_GASPARKLES | |
| 7196 | ✗ | tempitem.power=8; | |
| 7197 | ✗ | tempitem.flags|=(ITEM_GAMEDATA|ITEM_FLAG1); | |
| 7198 | ✗ | tempitem.wpn=wGARROW; | |
| 7199 | ✗ | break; | |
| 7200 | |||
| 7201 | case iBrang: | ||
| 7202 | ✗ | tempitem.power=0; | |
| 7203 | ✗ | tempitem.wpn=wBRANG; | |
| 7204 | ✗ | tempitem.misc1=36; | |
| 7205 | ✗ | break; | |
| 7206 | |||
| 7207 | case iMBrang: | ||
| 7208 | ✗ | tempitem.wpn2 = get_bit(deprecated_rules,29) ? wMSPARKLE : 0; //qr_MBSPARKLES | |
| 7209 | ✗ | tempitem.power=0; | |
| 7210 | ✗ | tempitem.wpn=wMBRANG; | |
| 7211 | ✗ | break; | |
| 7212 | |||
| 7213 | case iFBrang: | ||
| 7214 | ✗ | tempitem.wpn3 = get_bit(deprecated_rules,30) ? wFSPARKLE : 0; //qr_FBSPARKLES | |
| 7215 | ✗ | tempitem.power=2; | |
| 7216 | ✗ | tempitem.wpn=wFBRANG; | |
| 7217 | ✗ | break; | |
| 7218 | |||
| 7219 | case iBoots: | ||
| 7220 | ✗ | tempitem.cost_amount[0] = get_bit(deprecated_rules,51) ? 1 : 0; | |
| 7221 | ✗ | tempitem.power=7; | |
| 7222 | ✗ | break; | |
| 7223 | |||
| 7224 | case iWand: | ||
| 7225 | ✗ | tempitem.cost_amount[0] = get_bit(deprecated_rules,49) ? 8 : 0; | |
| 7226 | ✗ | tempitem.power=2; | |
| 7227 | ✗ | tempitem.wpn=wWAND; | |
| 7228 | ✗ | tempitem.wpn3=wMAGIC; | |
| 7229 | ✗ | break; | |
| 7230 | |||
| 7231 | case iBCandle: | ||
| 7232 | ✗ | tempitem.cost_amount[0] = get_bit(deprecated_rules,50) ? 4 : 0; | |
| 7233 | ✗ | tempitem.power=1; | |
| 7234 | ✗ | tempitem.flags|=(ITEM_GAMEDATA|ITEM_FLAG1); | |
| 7235 | ✗ | tempitem.wpn3=wFIRE; | |
| 7236 | ✗ | break; | |
| 7237 | |||
| 7238 | case iRCandle: | ||
| 7239 | ✗ | tempitem.cost_amount[0] = get_bit(deprecated_rules,50) ? 4 : 0; | |
| 7240 | ✗ | tempitem.power=1; | |
| 7241 | ✗ | tempitem.wpn3=wFIRE; | |
| 7242 | ✗ | break; | |
| 7243 | |||
| 7244 | case iSword: | ||
| 7245 | ✗ | tempitem.power=1; | |
| 7246 | ✗ | tempitem.flags|= ITEM_FLAG4 |ITEM_FLAG2; | |
| 7247 | ✗ | tempitem.wpn=tempitem.wpn3=wSWORD; | |
| 7248 | ✗ | tempitem.wpn2=wSWORDSLASH; | |
| 7249 | ✗ | break; | |
| 7250 | |||
| 7251 | case iWSword: | ||
| 7252 | ✗ | tempitem.power=2; | |
| 7253 | ✗ | tempitem.flags|= ITEM_FLAG4 |ITEM_FLAG2; | |
| 7254 | ✗ | tempitem.wpn=tempitem.wpn3=wWSWORD; | |
| 7255 | ✗ | tempitem.wpn2=wWSWORDSLASH; | |
| 7256 | ✗ | break; | |
| 7257 | |||
| 7258 | case iMSword: | ||
| 7259 | ✗ | tempitem.power=4; | |
| 7260 | ✗ | tempitem.flags|= ITEM_FLAG4 |ITEM_FLAG2; | |
| 7261 | ✗ | tempitem.wpn=tempitem.wpn3=wMSWORD; | |
| 7262 | ✗ | tempitem.wpn2=wMSWORDSLASH; | |
| 7263 | ✗ | break; | |
| 7264 | |||
| 7265 | case iXSword: | ||
| 7266 | ✗ | tempitem.power=8; | |
| 7267 | ✗ | tempitem.flags|= ITEM_FLAG4 |ITEM_FLAG2; | |
| 7268 | ✗ | tempitem.wpn=tempitem.wpn3=wXSWORD; | |
| 7269 | ✗ | tempitem.wpn2=wXSWORDSLASH; | |
| 7270 | ✗ | break; | |
| 7271 | |||
| 7272 | case iNayrusLove: | ||
| 7273 | ✗ | tempitem.flags |= get_bit(deprecated_rules,76) ? ITEM_FLAG1 : 0; | |
| 7274 | ✗ | tempitem.flags |= get_bit(deprecated_rules,75) ? ITEM_FLAG2 : 0; | |
| 7275 | ✗ | tempitem.wpn=wNAYRUSLOVE1A; | |
| 7276 | ✗ | tempitem.wpn2=wNAYRUSLOVE1B; | |
| 7277 | ✗ | tempitem.wpn3=wNAYRUSLOVES1A; | |
| 7278 | ✗ | tempitem.wpn4=wNAYRUSLOVES1B; | |
| 7279 | ✗ | tempitem.wpn6=wNAYRUSLOVE2A; | |
| 7280 | ✗ | tempitem.wpn7=wNAYRUSLOVE2B; | |
| 7281 | ✗ | tempitem.wpn8=wNAYRUSLOVES2A; | |
| 7282 | ✗ | tempitem.wpn9=wNAYRUSLOVES2B; | |
| 7283 | ✗ | tempitem.wpn5 = iwNayrusLoveShieldFront; | |
| 7284 | ✗ | tempitem.wpn10 = iwNayrusLoveShieldBack; | |
| 7285 | ✗ | tempitem.misc1=512; | |
| 7286 | ✗ | tempitem.cost_amount[0]=64; | |
| 7287 | ✗ | break; | |
| 7288 | |||
| 7289 | case iLens: | ||
| 7290 | ✗ | tempitem.misc1=60; | |
| 7291 | ✗ | tempitem.flags |= get_bit(quest_rules,qr_ENABLEMAGIC) ? 0 : ITEM_RUPEE_MAGIC; | |
| 7292 | ✗ | tempitem.cost_amount[0] = get_bit(quest_rules,qr_ENABLEMAGIC) ? 2 : 1; | |
| 7293 | ✗ | break; | |
| 7294 | |||
| 7295 | case iArrow: | ||
| 7296 | ✗ | tempitem.power=2; | |
| 7297 | ✗ | tempitem.wpn=wARROW; | |
| 7298 | ✗ | break; | |
| 7299 | |||
| 7300 | case iHoverBoots: | ||
| 7301 | ✗ | tempitem.misc1=45; | |
| 7302 | ✗ | tempitem.wpn=iwHover; | |
| 7303 | ✗ | break; | |
| 7304 | |||
| 7305 | case iDinsFire: | ||
| 7306 | ✗ | tempitem.power=8; | |
| 7307 | ✗ | tempitem.wpn=wDINSFIRE1A; | |
| 7308 | ✗ | tempitem.wpn2=wDINSFIRE1B; | |
| 7309 | ✗ | tempitem.wpn3=wDINSFIRES1A; | |
| 7310 | ✗ | tempitem.wpn4=wDINSFIRES1B; | |
| 7311 | ✗ | tempitem.misc1 = 32; | |
| 7312 | ✗ | tempitem.misc2 = 200; | |
| 7313 | ✗ | tempitem.cost_amount[0]=32; | |
| 7314 | ✗ | break; | |
| 7315 | |||
| 7316 | case iFaroresWind: | ||
| 7317 | ✗ | tempitem.cost_amount[0]=32; | |
| 7318 | ✗ | break; | |
| 7319 | |||
| 7320 | case iHookshot: | ||
| 7321 | ✗ | tempitem.power=0; | |
| 7322 | ✗ | tempitem.flags&=~ITEM_FLAG1; | |
| 7323 | ✗ | tempitem.wpn=wHSHEAD; | |
| 7324 | ✗ | tempitem.wpn2=wHSCHAIN_H; | |
| 7325 | ✗ | tempitem.wpn4=wHSHANDLE; | |
| 7326 | ✗ | tempitem.wpn3=wHSCHAIN_V; | |
| 7327 | ✗ | tempitem.misc1=50; | |
| 7328 | ✗ | tempitem.misc2=100; | |
| 7329 | ✗ | break; | |
| 7330 | |||
| 7331 | case iLongshot: | ||
| 7332 | ✗ | tempitem.power=0; | |
| 7333 | ✗ | tempitem.flags&=~ITEM_FLAG1; | |
| 7334 | ✗ | tempitem.wpn=wLSHEAD; | |
| 7335 | ✗ | tempitem.wpn2=wLSCHAIN_H; | |
| 7336 | ✗ | tempitem.wpn4=wLSHANDLE; | |
| 7337 | ✗ | tempitem.wpn3=wLSCHAIN_V; | |
| 7338 | ✗ | tempitem.misc1=99; | |
| 7339 | ✗ | tempitem.misc2=100; | |
| 7340 | ✗ | break; | |
| 7341 | |||
| 7342 | case iHammer: | ||
| 7343 | ✗ | tempitem.power=4; | |
| 7344 | ✗ | tempitem.wpn=wHAMMER; | |
| 7345 | ✗ | tempitem.wpn2=iwHammerSmack; | |
| 7346 | ✗ | break; | |
| 7347 | |||
| 7348 | case iCByrna: | ||
| 7349 | ✗ | tempitem.power=1; | |
| 7350 | ✗ | tempitem.wpn=wCBYRNA; | |
| 7351 | ✗ | tempitem.wpn2=wCBYRNASLASH; | |
| 7352 | ✗ | tempitem.wpn3=wCBYRNAORB; | |
| 7353 | ✗ | tempitem.misc1=4; | |
| 7354 | ✗ | tempitem.misc2=16; | |
| 7355 | ✗ | tempitem.misc3=1; | |
| 7356 | ✗ | tempitem.cost_amount[0]=1; | |
| 7357 | ✗ | break; | |
| 7358 | |||
| 7359 | case iWhistle: | ||
| 7360 | ✗ | tempitem.wpn=wWIND; | |
| 7361 | ✗ | tempitem.misc1=3; | |
| 7362 | ✗ | tempitem.flags|=ITEM_FLAG1; | |
| 7363 | ✗ | break; | |
| 7364 | |||
| 7365 | case iBRing: | ||
| 7366 | ✗ | tempitem.power=2; | |
| 7367 | ✗ | tempitem.misc1=spBLUE; | |
| 7368 | ✗ | break; | |
| 7369 | |||
| 7370 | case iRRing: | ||
| 7371 | ✗ | tempitem.power=4; | |
| 7372 | ✗ | tempitem.misc1=spRED; | |
| 7373 | ✗ | break; | |
| 7374 | |||
| 7375 | case iGRing: | ||
| 7376 | ✗ | tempitem.power=8; | |
| 7377 | ✗ | tempitem.misc1=spGOLD; | |
| 7378 | ✗ | break; | |
| 7379 | |||
| 7380 | case iSpinScroll: | ||
| 7381 | ✗ | tempitem.power = 2; | |
| 7382 | ✗ | tempitem.misc1 = 1; | |
| 7383 | ✗ | break; | |
| 7384 | |||
| 7385 | case iL2SpinScroll: | ||
| 7386 | ✗ | tempitem.family=itype_spinscroll2; | |
| 7387 | ✗ | tempitem.fam_type=1; | |
| 7388 | ✗ | tempitem.cost_amount[0]=8; | |
| 7389 | ✗ | tempitem.power=2; | |
| 7390 | ✗ | tempitem.misc1 = 20; | |
| 7391 | ✗ | break; | |
| 7392 | |||
| 7393 | case iQuakeScroll: | ||
| 7394 | ✗ | tempitem.misc1=0x10; | |
| 7395 | ✗ | tempitem.misc2=64; | |
| 7396 | ✗ | break; | |
| 7397 | |||
| 7398 | case iL2QuakeScroll: | ||
| 7399 | ✗ | tempitem.family=itype_quakescroll2; | |
| 7400 | ✗ | tempitem.fam_type=1; | |
| 7401 | ✗ | tempitem.power = 2; | |
| 7402 | ✗ | tempitem.misc1=0x20; | |
| 7403 | ✗ | tempitem.misc2=192; | |
| 7404 | ✗ | tempitem.cost_amount[0]=8; | |
| 7405 | ✗ | break; | |
| 7406 | |||
| 7407 | case iChargeRing: | ||
| 7408 | ✗ | tempitem.misc1=64; | |
| 7409 | ✗ | tempitem.misc2=128; | |
| 7410 | ✗ | break; | |
| 7411 | |||
| 7412 | case iL2ChargeRing: | ||
| 7413 | ✗ | tempitem.misc1=32; | |
| 7414 | ✗ | tempitem.misc2=64; | |
| 7415 | ✗ | break; | |
| 7416 | |||
| 7417 | case iOldGlove: | ||
| 7418 | ✗ | tempitem.flags |= ITEM_FLAG1; | |
| 7419 | |||
| 7420 | //fallthrough | ||
| 7421 | case iBombBagL4: | ||
| 7422 | case iWalletL3: | ||
| 7423 | case iQuiverL4: | ||
| 7424 | case iBracelet: | ||
| 7425 | ✗ | tempitem.power = 1; | |
| 7426 | ✗ | break; | |
| 7427 | |||
| 7428 | case iL2Bracelet: | ||
| 7429 | ✗ | tempitem.power = 2; | |
| 7430 | ✗ | break; | |
| 7431 | |||
| 7432 | case iMKey: | ||
| 7433 | ✗ | tempitem.power=0xFF; | |
| 7434 | ✗ | tempitem.flags |= ITEM_FLAG1; | |
| 7435 | ✗ | break; | |
| 7436 | } | ||
| 7437 | } | ||
| 7438 | |||
| 7439 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version < 7) |
| 7440 | { | ||
| 7441 | ✗ | switch(i) | |
| 7442 | { | ||
| 7443 | case iStoneAgony: | ||
| 7444 | case iStompBoots: | ||
| 7445 | case iPerilRing: | ||
| 7446 | case iWhimsicalRing: | ||
| 7447 | { | ||
| 7448 | ✗ | reset_itembuf(&tempitem, i); | |
| 7449 | ✗ | strcpy(item_string[i],old_item_string[i]); | |
| 7450 | ✗ | break; | |
| 7451 | } | ||
| 7452 | } | ||
| 7453 | } | ||
| 7454 | |||
| 7455 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version < 8) // May 2007: Some corrections. |
| 7456 | { | ||
| 7457 | ✗ | switch(i) | |
| 7458 | { | ||
| 7459 | case iMShield: | ||
| 7460 | ✗ | tempitem.misc1|=shFLAME; | |
| 7461 | ✗ | tempitem.misc2|=shFIREBALL|shMAGIC; | |
| 7462 | |||
| 7463 | ✗ | if(get_bit(quest_rules, qr_SWORDMIRROR)) | |
| 7464 | { | ||
| 7465 | ✗ | tempitem.misc2 |= shSWORD; | |
| 7466 | } | ||
| 7467 | |||
| 7468 | // fallthrough | ||
| 7469 | case iShield: | ||
| 7470 | ✗ | tempitem.misc1|=shFIREBALL|shSWORD|shMAGIC; | |
| 7471 | |||
| 7472 | // fallthrough | ||
| 7473 | case iSShield: | ||
| 7474 | ✗ | tempitem.misc1|=shROCK|shARROW|shBRANG|shSCRIPT; | |
| 7475 | |||
| 7476 | ✗ | if(get_bit(deprecated_rules,102)) //qr_REFLECTROCKS | |
| 7477 | { | ||
| 7478 | ✗ | tempitem.misc2 |= shROCK; | |
| 7479 | } | ||
| 7480 | |||
| 7481 | ✗ | break; | |
| 7482 | |||
| 7483 | case iWhispRing: | ||
| 7484 | ✗ | tempitem.power=1; | |
| 7485 | ✗ | tempitem.flags|=ITEM_GAMEDATA|ITEM_FLAG1; | |
| 7486 | ✗ | tempitem.misc1 = 3; | |
| 7487 | ✗ | break; | |
| 7488 | |||
| 7489 | case iL2WhispRing: | ||
| 7490 | ✗ | tempitem.power=0; | |
| 7491 | ✗ | tempitem.flags|=ITEM_GAMEDATA|ITEM_FLAG1; | |
| 7492 | ✗ | tempitem.misc1 = 3; | |
| 7493 | ✗ | break; | |
| 7494 | |||
| 7495 | case iL2Ladder: | ||
| 7496 | case iBow: | ||
| 7497 | case iCByrna: | ||
| 7498 | ✗ | tempitem.power = 1; | |
| 7499 | ✗ | break; | |
| 7500 | } | ||
| 7501 | } | ||
| 7502 | |||
| 7503 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
19712 | if(s_version < 9 && i==iClock) |
| 7504 | { | ||
| 7505 | ✗ | tempitem.misc1 = get_bit(deprecated_rules, qr_TEMPCLOCKS_DEP) ? 256 : 0; | |
| 7506 | } | ||
| 7507 | |||
| 7508 | //add the misc flag for bomb | ||
| 7509 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
19712 | if(s_version < 10 && tempitem.family == itype_bomb) |
| 7510 | { | ||
| 7511 | ✗ | tempitem.flags = (tempitem.flags & ~ITEM_FLAG1) | (get_bit(quest_rules, qr_LONGBOMBBOOM_DEP) ? ITEM_FLAG1 : 0); | |
| 7512 | } | ||
| 7513 | |||
| 7514 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
19712 | if(s_version < 11 && tempitem.family == itype_triforcepiece) |
| 7515 | { | ||
| 7516 | ✗ | tempitem.flags = (tempitem.fam_type ? ITEM_GAMEDATA : 0); | |
| 7517 | ✗ | tempitem.playsound = (tempitem.fam_type ? WAV_SCALE : WAV_CLEARED); | |
| 7518 | } | ||
| 7519 | |||
| 7520 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version < 12) // June 2007: More Misc. attributes. |
| 7521 | { | ||
| 7522 | ✗ | switch(i) | |
| 7523 | { | ||
| 7524 | case iFBrang: | ||
| 7525 | ✗ | tempitem.misc4 |= shFIREBALL|shSWORD|shMAGIC; | |
| 7526 | |||
| 7527 | //fallthrough | ||
| 7528 | case iMBrang: | ||
| 7529 | ✗ | tempitem.misc3 |= shSWORD|shMAGIC; | |
| 7530 | |||
| 7531 | //fallthrough | ||
| 7532 | case iHookshot: | ||
| 7533 | case iLongshot: | ||
| 7534 | //fallthrough | ||
| 7535 | ✗ | tempitem.misc3 |= shFIREBALL; | |
| 7536 | |||
| 7537 | case iBrang: | ||
| 7538 | ✗ | tempitem.misc3 |= shBRANG|shROCK|shARROW; | |
| 7539 | ✗ | break; | |
| 7540 | } | ||
| 7541 | |||
| 7542 | ✗ | switch(tempitem.family) | |
| 7543 | { | ||
| 7544 | case itype_hoverboots: | ||
| 7545 | ✗ | tempitem.usesound = WAV_ZN1HOVER; | |
| 7546 | ✗ | break; | |
| 7547 | |||
| 7548 | case itype_wand: | ||
| 7549 | case itype_book: | ||
| 7550 | ✗ | tempitem.usesound = WAV_WAND; | |
| 7551 | ✗ | break; | |
| 7552 | |||
| 7553 | case itype_arrow: | ||
| 7554 | ✗ | tempitem.usesound = WAV_ARROW; | |
| 7555 | ✗ | break; | |
| 7556 | |||
| 7557 | case itype_hookshot: | ||
| 7558 | ✗ | tempitem.usesound = WAV_HOOKSHOT; | |
| 7559 | ✗ | break; | |
| 7560 | |||
| 7561 | case itype_brang: | ||
| 7562 | ✗ | tempitem.usesound = WAV_BRANG; | |
| 7563 | ✗ | break; | |
| 7564 | |||
| 7565 | case itype_shield: | ||
| 7566 | ✗ | tempitem.usesound = WAV_CHINK; | |
| 7567 | ✗ | break; | |
| 7568 | |||
| 7569 | case itype_sword: | ||
| 7570 | ✗ | tempitem.usesound = WAV_SWORD; | |
| 7571 | ✗ | break; | |
| 7572 | |||
| 7573 | case itype_whistle: | ||
| 7574 | ✗ | tempitem.usesound = WAV_WHISTLE; | |
| 7575 | ✗ | break; | |
| 7576 | |||
| 7577 | case itype_hammer: | ||
| 7578 | ✗ | tempitem.usesound = WAV_HAMMER; | |
| 7579 | ✗ | break; | |
| 7580 | |||
| 7581 | case itype_dinsfire: | ||
| 7582 | ✗ | tempitem.usesound = WAV_ZN1DINSFIRE; | |
| 7583 | ✗ | break; | |
| 7584 | |||
| 7585 | case itype_faroreswind: | ||
| 7586 | ✗ | tempitem.usesound = WAV_ZN1FARORESWIND; | |
| 7587 | ✗ | break; | |
| 7588 | |||
| 7589 | case itype_nayruslove: | ||
| 7590 | ✗ | tempitem.usesound = WAV_ZN1NAYRUSLOVE1; | |
| 7591 | ✗ | break; | |
| 7592 | |||
| 7593 | case itype_bomb: | ||
| 7594 | case itype_sbomb: | ||
| 7595 | case itype_quakescroll: | ||
| 7596 | case itype_quakescroll2: | ||
| 7597 | ✗ | tempitem.usesound = WAV_BOMB; | |
| 7598 | ✗ | break; | |
| 7599 | |||
| 7600 | case itype_spinscroll: | ||
| 7601 | case itype_spinscroll2: | ||
| 7602 | ✗ | tempitem.usesound = WAV_ZN1SPINATTACK; | |
| 7603 | ✗ | break; | |
| 7604 | } | ||
| 7605 | } | ||
| 7606 | |||
| 7607 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version < 13) // July 2007 |
| 7608 | { | ||
| 7609 | ✗ | if(tempitem.family == itype_whistle) | |
| 7610 | { | ||
| 7611 | ✗ | tempitem.misc1 = (tempitem.power==2 ? 4 : 3); | |
| 7612 | ✗ | tempitem.power = 1; | |
| 7613 | ✗ | tempitem.flags|=ITEM_FLAG1; | |
| 7614 | } | ||
| 7615 | ✗ | else if(tempitem.family == itype_wand) | |
| 7616 | ✗ | tempitem.flags|=ITEM_FLAG1; | |
| 7617 | ✗ | else if(tempitem.family == itype_book) | |
| 7618 | { | ||
| 7619 | ✗ | tempitem.flags|=ITEM_FLAG1; | |
| 7620 | ✗ | tempitem.power = 2; | |
| 7621 | } | ||
| 7622 | } | ||
| 7623 | |||
| 7624 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version < 14) // August 2007 |
| 7625 | { | ||
| 7626 | ✗ | if(tempitem.family == itype_fairy) | |
| 7627 | { | ||
| 7628 | ✗ | tempitem.usesound = WAV_SCALE; | |
| 7629 | |||
| 7630 | ✗ | if(tempitem.fam_type) | |
| 7631 | ✗ | tempitem.misc3=50; | |
| 7632 | } | ||
| 7633 | ✗ | else if(tempitem.family == itype_potion) | |
| 7634 | { | ||
| 7635 | ✗ | tempitem.flags |= ITEM_GAINOLD; | |
| 7636 | } | ||
| 7637 | } | ||
| 7638 | |||
| 7639 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version < 17) // November 2007 |
| 7640 | { | ||
| 7641 | ✗ | if(tempitem.family == itype_candle && !tempitem.wpn3) | |
| 7642 | { | ||
| 7643 | ✗ | tempitem.wpn3 = wFIRE; | |
| 7644 | } | ||
| 7645 | ✗ | else if(tempitem.family == itype_arrow && tempitem.power>4) | |
| 7646 | { | ||
| 7647 | ✗ | tempitem.flags|=ITEM_FLAG1; | |
| 7648 | } | ||
| 7649 | } | ||
| 7650 | |||
| 7651 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version < 18) // New Year's Eve 2007 |
| 7652 | { | ||
| 7653 | ✗ | if(tempitem.family == itype_whistle) | |
| 7654 | ✗ | tempitem.misc2 = 8; // Use the Whistle warp ring | |
| 7655 | ✗ | else if(tempitem.family == itype_bait) | |
| 7656 | ✗ | tempitem.misc1 = 768; // Frames until it goes | |
| 7657 | ✗ | else if(tempitem.family == itype_triforcepiece) | |
| 7658 | { | ||
| 7659 | ✗ | if(tempitem.flags & ITEM_GAMEDATA) | |
| 7660 | { | ||
| 7661 | ✗ | tempitem.misc2 = 1; // Cutscene 1 | |
| 7662 | ✗ | tempitem.flags |= ITEM_FLAG1; // Side Warp Out | |
| 7663 | } | ||
| 7664 | } | ||
| 7665 | } | ||
| 7666 | |||
| 7667 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version < 19) // January 2008 |
| 7668 | { | ||
| 7669 | ✗ | if(tempitem.family == itype_nayruslove) | |
| 7670 | { | ||
| 7671 | ✗ | tempitem.flags |= get_bit(deprecated_rules,qr_NOBOMBPALFLASH+1)?ITEM_FLAG3:0; | |
| 7672 | ✗ | tempitem.flags |= get_bit(deprecated_rules,qr_NOBOMBPALFLASH+2)?ITEM_FLAG4:0; | |
| 7673 | } | ||
| 7674 | } | ||
| 7675 | |||
| 7676 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version < 20) // October 2008 |
| 7677 | { | ||
| 7678 | ✗ | if(tempitem.family == itype_nayruslove) | |
| 7679 | { | ||
| 7680 | ✗ | tempitem.wpn6=wNAYRUSLOVE2A; | |
| 7681 | ✗ | tempitem.wpn7=wNAYRUSLOVE2B; | |
| 7682 | ✗ | tempitem.wpn8=wNAYRUSLOVES2A; | |
| 7683 | ✗ | tempitem.wpn9=wNAYRUSLOVES2B; | |
| 7684 | ✗ | tempitem.wpn5 = iwNayrusLoveShieldFront; | |
| 7685 | ✗ | tempitem.wpn10 = iwNayrusLoveShieldBack; | |
| 7686 | } | ||
| 7687 | } | ||
| 7688 | |||
| 7689 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version < 21) // November 2008 |
| 7690 | { | ||
| 7691 | ✗ | if(tempitem.flags & 0x0100) // ITEM_SLASH | |
| 7692 | { | ||
| 7693 | ✗ | tempitem.flags &= ~0x0100; | |
| 7694 | |||
| 7695 | ✗ | if(tempitem.family == itype_sword || | |
| 7696 | ✗ | tempitem.family == itype_wand || | |
| 7697 | ✗ | tempitem.family == itype_candle || | |
| 7698 | ✗ | tempitem.family == itype_cbyrna) | |
| 7699 | { | ||
| 7700 | ✗ | tempitem.flags |= ITEM_FLAG4; | |
| 7701 | } | ||
| 7702 | } | ||
| 7703 | } | ||
| 7704 | |||
| 7705 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version < 22) // September 2009 |
| 7706 | { | ||
| 7707 | ✗ | if(tempitem.family == itype_sbomb || tempitem.family == itype_bomb) | |
| 7708 | { | ||
| 7709 | ✗ | tempitem.misc3 = tempitem.power/2; | |
| 7710 | } | ||
| 7711 | } | ||
| 7712 | |||
| 7713 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version < 23) // March 2011 |
| 7714 | { | ||
| 7715 | ✗ | if(tempitem.family == itype_dinsfire) | |
| 7716 | ✗ | tempitem.wpn5 = wFIRE; | |
| 7717 | ✗ | else if(tempitem.family == itype_book) | |
| 7718 | ✗ | tempitem.wpn2 = wFIRE; | |
| 7719 | } | ||
| 7720 | |||
| 7721 | // Version 25: Bomb bags were acting as though "super bombs also" was checked | ||
| 7722 | // whether it was or not, and a lot of existing quests depended on the | ||
| 7723 | // incorrect behavior. | ||
| 7724 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version < 25) // January 2012 |
| 7725 | { | ||
| 7726 | ✗ | if(tempitem.family == itype_bombbag) | |
| 7727 | ✗ | tempitem.flags |= 16; | |
| 7728 | |||
| 7729 | ✗ | if(tempitem.family == itype_dinsfire) | |
| 7730 | ✗ | tempitem.flags |= ITEM_FLAG3; // Sideview gravity flag | |
| 7731 | } | ||
| 7732 | |||
| 7733 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if( version < 0x254) //Nuke greyed-out flags/values from <=2.53, in case they are used in 2.54/2.55 |
| 7734 | { | ||
| 7735 |
60/60✓ Branch 0 taken 1409 times.
✓ Branch 1 taken 746 times.
✓ Branch 2 taken 207 times.
✓ Branch 3 taken 881 times.
✓ Branch 4 taken 2155 times.
✓ Branch 5 taken 5945 times.
✓ Branch 6 taken 207 times.
✓ Branch 7 taken 207 times.
✓ Branch 8 taken 176 times.
✓ Branch 9 taken 115 times.
✓ Branch 10 taken 69 times.
✓ Branch 11 taken 138 times.
✓ Branch 12 taken 138 times.
✓ Branch 13 taken 84 times.
✓ Branch 14 taken 207 times.
✓ Branch 15 taken 207 times.
✓ Branch 16 taken 138 times.
✓ Branch 17 taken 207 times.
✓ Branch 18 taken 138 times.
✓ Branch 19 taken 69 times.
✓ Branch 20 taken 138 times.
✓ Branch 21 taken 84 times.
✓ Branch 22 taken 69 times.
✓ Branch 23 taken 207 times.
✓ Branch 24 taken 69 times.
✓ Branch 25 taken 69 times.
✓ Branch 26 taken 138 times.
✓ Branch 27 taken 69 times.
✓ Branch 28 taken 69 times.
✓ Branch 29 taken 69 times.
✓ Branch 30 taken 69 times.
✓ Branch 31 taken 69 times.
✓ Branch 32 taken 84 times.
✓ Branch 33 taken 69 times.
✓ Branch 34 taken 69 times.
✓ Branch 35 taken 69 times.
✓ Branch 36 taken 69 times.
✓ Branch 37 taken 138 times.
✓ Branch 38 taken 276 times.
✓ Branch 39 taken 69 times.
✓ Branch 40 taken 69 times.
✓ Branch 41 taken 120 times.
✓ Branch 42 taken 276 times.
✓ Branch 43 taken 69 times.
✓ Branch 44 taken 69 times.
✓ Branch 45 taken 69 times.
✓ Branch 46 taken 69 times.
✓ Branch 47 taken 69 times.
✓ Branch 48 taken 138 times.
✓ Branch 49 taken 138 times.
✓ Branch 50 taken 69 times.
✓ Branch 51 taken 207 times.
✓ Branch 52 taken 207 times.
✓ Branch 53 taken 276 times.
✓ Branch 54 taken 69 times.
✓ Branch 55 taken 69 times.
✓ Branch 56 taken 69 times.
✓ Branch 57 taken 69 times.
✓ Branch 58 taken 69 times.
✓ Branch 59 taken 69 times.
|
17664 | switch(tempitem.family) |
| 7736 | { | ||
| 7737 | case itype_sword: | ||
| 7738 | { | ||
| 7739 | 5945 | tempitem.flags &= ~(ITEM_FLAG5); | |
| 7740 | 5945 | tempitem.misc3 = 0; | |
| 7741 | 5945 | tempitem.misc4 = 0; | |
| 7742 | 5945 | tempitem.misc5 = 0; | |
| 7743 | 5945 | tempitem.misc6 = 0; | |
| 7744 | 5945 | tempitem.misc7 = 0; | |
| 7745 | 5945 | tempitem.misc8 = 0; | |
| 7746 | 5945 | tempitem.misc9 = 0; | |
| 7747 | 5945 | tempitem.misc10 = 0; | |
| 7748 | 5945 | tempitem.wpn4 = 0; | |
| 7749 | 5945 | tempitem.wpn5 = 0; | |
| 7750 | 5945 | tempitem.wpn6 = 0; | |
| 7751 | 5945 | tempitem.wpn7 = 0; | |
| 7752 | 5945 | tempitem.wpn8 = 0; | |
| 7753 | 5945 | tempitem.wpn9 = 0; | |
| 7754 | 5945 | tempitem.wpn10 = 0; | |
| 7755 | 5945 | break; | |
| 7756 | } | ||
| 7757 | case itype_brang: | ||
| 7758 | { | ||
| 7759 | 207 | tempitem.flags &= ~(ITEM_FLAG4 | ITEM_FLAG5); | |
| 7760 | 207 | tempitem.misc2 = 0; | |
| 7761 | 207 | tempitem.misc5 = 0; | |
| 7762 | 207 | tempitem.misc6 = 0; | |
| 7763 | 207 | tempitem.misc7 = 0; | |
| 7764 | 207 | tempitem.misc8 = 0; | |
| 7765 | 207 | tempitem.misc9 = 0; | |
| 7766 | 207 | tempitem.misc10 = 0; | |
| 7767 | 207 | tempitem.wpn4 = 0; | |
| 7768 | 207 | tempitem.wpn5 = 0; | |
| 7769 | 207 | tempitem.wpn6 = 0; | |
| 7770 | 207 | tempitem.wpn7 = 0; | |
| 7771 | 207 | tempitem.wpn8 = 0; | |
| 7772 | 207 | tempitem.wpn9 = 0; | |
| 7773 | 207 | tempitem.wpn10 = 0; | |
| 7774 | 207 | break; | |
| 7775 | } | ||
| 7776 | case itype_arrow: | ||
| 7777 | { | ||
| 7778 | 207 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 7779 | 207 | tempitem.misc2 = 0; | |
| 7780 | 207 | tempitem.misc3 = 0; | |
| 7781 | 207 | tempitem.misc4 = 0; | |
| 7782 | 207 | tempitem.misc5 = 0; | |
| 7783 | 207 | tempitem.misc6 = 0; | |
| 7784 | 207 | tempitem.misc7 = 0; | |
| 7785 | 207 | tempitem.misc8 = 0; | |
| 7786 | 207 | tempitem.misc9 = 0; | |
| 7787 | 207 | tempitem.misc10 = 0; | |
| 7788 | 207 | tempitem.wpn4 = 0; | |
| 7789 | 207 | tempitem.wpn5 = 0; | |
| 7790 | 207 | tempitem.wpn6 = 0; | |
| 7791 | 207 | tempitem.wpn7 = 0; | |
| 7792 | 207 | tempitem.wpn8 = 0; | |
| 7793 | 207 | tempitem.wpn9 = 0; | |
| 7794 | 207 | tempitem.wpn10 = 0; | |
| 7795 | 207 | break; | |
| 7796 | } | ||
| 7797 | case itype_candle: | ||
| 7798 | { | ||
| 7799 | 176 | tempitem.flags &= ~ (ITEM_FLAG3 | ITEM_FLAG5); | |
| 7800 | 176 | tempitem.misc1 = 0; | |
| 7801 | 176 | tempitem.misc2 = 0; | |
| 7802 | 176 | tempitem.misc3 = 0; | |
| 7803 | 176 | tempitem.misc4 = 0; | |
| 7804 | 176 | tempitem.misc5 = 0; | |
| 7805 | 176 | tempitem.misc6 = 0; | |
| 7806 | 176 | tempitem.misc7 = 0; | |
| 7807 | 176 | tempitem.misc8 = 0; | |
| 7808 | 176 | tempitem.misc9 = 0; | |
| 7809 | 176 | tempitem.misc10 = 0; | |
| 7810 | 176 | tempitem.wpn4 = 0; | |
| 7811 | 176 | tempitem.wpn5 = 0; | |
| 7812 | 176 | tempitem.wpn6 = 0; | |
| 7813 | 176 | tempitem.wpn7 = 0; | |
| 7814 | 176 | tempitem.wpn8 = 0; | |
| 7815 | 176 | tempitem.wpn9 = 0; | |
| 7816 | 176 | tempitem.wpn10 = 0; | |
| 7817 | 176 | break; | |
| 7818 | } | ||
| 7819 | case itype_whistle: | ||
| 7820 | { | ||
| 7821 | 115 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 7822 | 115 | tempitem.misc3 = 0; | |
| 7823 | 115 | tempitem.misc4 = 0; | |
| 7824 | 115 | tempitem.misc5 = 0; | |
| 7825 | 115 | tempitem.misc6 = 0; | |
| 7826 | 115 | tempitem.misc7 = 0; | |
| 7827 | 115 | tempitem.misc8 = 0; | |
| 7828 | 115 | tempitem.misc9 = 0; | |
| 7829 | 115 | tempitem.misc10 = 0; | |
| 7830 | 115 | tempitem.wpn2 = 0; | |
| 7831 | 115 | tempitem.wpn3 = 0; | |
| 7832 | 115 | tempitem.wpn4 = 0; | |
| 7833 | 115 | tempitem.wpn5 = 0; | |
| 7834 | 115 | tempitem.wpn6 = 0; | |
| 7835 | 115 | tempitem.wpn7 = 0; | |
| 7836 | 115 | tempitem.wpn8 = 0; | |
| 7837 | 115 | tempitem.wpn9 = 0; | |
| 7838 | 115 | tempitem.wpn10 = 0; | |
| 7839 | 115 | break; | |
| 7840 | } | ||
| 7841 | case itype_bait: | ||
| 7842 | { | ||
| 7843 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 7844 | 69 | tempitem.misc2 = 0; | |
| 7845 | 69 | tempitem.misc3 = 0; | |
| 7846 | 69 | tempitem.misc4 = 0; | |
| 7847 | 69 | tempitem.misc5 = 0; | |
| 7848 | 69 | tempitem.misc6 = 0; | |
| 7849 | 69 | tempitem.misc7 = 0; | |
| 7850 | 69 | tempitem.misc8 = 0; | |
| 7851 | 69 | tempitem.misc9 = 0; | |
| 7852 | 69 | tempitem.misc10 = 0; | |
| 7853 | 69 | tempitem.wpn2 = 0; | |
| 7854 | 69 | tempitem.wpn3 = 0; | |
| 7855 | 69 | tempitem.wpn4 = 0; | |
| 7856 | 69 | tempitem.wpn5 = 0; | |
| 7857 | 69 | tempitem.wpn6 = 0; | |
| 7858 | 69 | tempitem.wpn7 = 0; | |
| 7859 | 69 | tempitem.wpn8 = 0; | |
| 7860 | 69 | tempitem.wpn9 = 0; | |
| 7861 | 69 | tempitem.wpn10 = 0; | |
| 7862 | 69 | break; | |
| 7863 | } | ||
| 7864 | case itype_letter: | ||
| 7865 | { | ||
| 7866 | 138 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 7867 | 138 | tempitem.misc1 = 0; | |
| 7868 | 138 | tempitem.misc2 = 0; | |
| 7869 | 138 | tempitem.misc3 = 0; | |
| 7870 | 138 | tempitem.misc4 = 0; | |
| 7871 | 138 | tempitem.misc5 = 0; | |
| 7872 | 138 | tempitem.misc6 = 0; | |
| 7873 | 138 | tempitem.misc7 = 0; | |
| 7874 | 138 | tempitem.misc8 = 0; | |
| 7875 | 138 | tempitem.misc9 = 0; | |
| 7876 | 138 | tempitem.misc10 = 0; | |
| 7877 | 138 | tempitem.wpn = 0; | |
| 7878 | 138 | tempitem.wpn2 = 0; | |
| 7879 | 138 | tempitem.wpn3 = 0; | |
| 7880 | 138 | tempitem.wpn4 = 0; | |
| 7881 | 138 | tempitem.wpn5 = 0; | |
| 7882 | 138 | tempitem.wpn6 = 0; | |
| 7883 | 138 | tempitem.wpn7 = 0; | |
| 7884 | 138 | tempitem.wpn8 = 0; | |
| 7885 | 138 | tempitem.wpn9 = 0; | |
| 7886 | 138 | tempitem.wpn10 = 0; | |
| 7887 | 138 | break; | |
| 7888 | } | ||
| 7889 | case itype_potion: | ||
| 7890 | { | ||
| 7891 | 138 | tempitem.flags &= ~ (ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 7892 | 138 | tempitem.misc3 = 0; | |
| 7893 | 138 | tempitem.misc4 = 0; | |
| 7894 | 138 | tempitem.misc5 = 0; | |
| 7895 | 138 | tempitem.misc6 = 0; | |
| 7896 | 138 | tempitem.misc7 = 0; | |
| 7897 | 138 | tempitem.misc8 = 0; | |
| 7898 | 138 | tempitem.misc9 = 0; | |
| 7899 | 138 | tempitem.misc10 = 0; | |
| 7900 | 138 | tempitem.wpn = 0; | |
| 7901 | 138 | tempitem.wpn2 = 0; | |
| 7902 | 138 | tempitem.wpn3 = 0; | |
| 7903 | 138 | tempitem.wpn4 = 0; | |
| 7904 | 138 | tempitem.wpn5 = 0; | |
| 7905 | 138 | tempitem.wpn6 = 0; | |
| 7906 | 138 | tempitem.wpn7 = 0; | |
| 7907 | 138 | tempitem.wpn8 = 0; | |
| 7908 | 138 | tempitem.wpn9 = 0; | |
| 7909 | 138 | tempitem.wpn10 = 0; | |
| 7910 | 138 | break; | |
| 7911 | } | ||
| 7912 | case itype_wand: | ||
| 7913 | { | ||
| 7914 | 84 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG5); | |
| 7915 | 84 | tempitem.misc1 = 0; | |
| 7916 | 84 | tempitem.misc2 = 0; | |
| 7917 | 84 | tempitem.misc3 = 0; | |
| 7918 | 84 | tempitem.misc4 = 0; | |
| 7919 | 84 | tempitem.misc5 = 0; | |
| 7920 | 84 | tempitem.misc6 = 0; | |
| 7921 | 84 | tempitem.misc7 = 0; | |
| 7922 | 84 | tempitem.misc8 = 0; | |
| 7923 | 84 | tempitem.misc9 = 0; | |
| 7924 | 84 | tempitem.misc10 = 0; | |
| 7925 | 84 | tempitem.wpn4 = 0; | |
| 7926 | 84 | tempitem.wpn5 = 0; | |
| 7927 | 84 | tempitem.wpn6 = 0; | |
| 7928 | 84 | tempitem.wpn7 = 0; | |
| 7929 | 84 | tempitem.wpn8 = 0; | |
| 7930 | 84 | tempitem.wpn9 = 0; | |
| 7931 | 84 | tempitem.wpn10 = 0; | |
| 7932 | 84 | break; | |
| 7933 | } | ||
| 7934 | case itype_ring: | ||
| 7935 | { | ||
| 7936 | 207 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 7937 | 207 | tempitem.misc2 = 0; | |
| 7938 | 207 | tempitem.misc3 = 0; | |
| 7939 | 207 | tempitem.misc4 = 0; | |
| 7940 | 207 | tempitem.misc5 = 0; | |
| 7941 | 207 | tempitem.misc6 = 0; | |
| 7942 | 207 | tempitem.misc7 = 0; | |
| 7943 | 207 | tempitem.misc8 = 0; | |
| 7944 | 207 | tempitem.misc9 = 0; | |
| 7945 | 207 | tempitem.misc10 = 0; | |
| 7946 | 207 | tempitem.wpn = 0; | |
| 7947 | 207 | tempitem.wpn2 = 0; | |
| 7948 | 207 | tempitem.wpn3 = 0; | |
| 7949 | 207 | tempitem.wpn4 = 0; | |
| 7950 | 207 | tempitem.wpn5 = 0; | |
| 7951 | 207 | tempitem.wpn6 = 0; | |
| 7952 | 207 | tempitem.wpn7 = 0; | |
| 7953 | 207 | tempitem.wpn8 = 0; | |
| 7954 | 207 | tempitem.wpn9 = 0; | |
| 7955 | 207 | tempitem.wpn10 = 0; | |
| 7956 | 207 | break; | |
| 7957 | } | ||
| 7958 | case itype_wallet: | ||
| 7959 | { | ||
| 7960 | 207 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 7961 | 207 | tempitem.misc3 = 0; | |
| 7962 | 207 | tempitem.misc4 = 0; | |
| 7963 | 207 | tempitem.misc5 = 0; | |
| 7964 | 207 | tempitem.misc6 = 0; | |
| 7965 | 207 | tempitem.misc7 = 0; | |
| 7966 | 207 | tempitem.misc8 = 0; | |
| 7967 | 207 | tempitem.misc9 = 0; | |
| 7968 | 207 | tempitem.misc10 = 0; | |
| 7969 | 207 | tempitem.wpn = 0; | |
| 7970 | 207 | tempitem.wpn2 = 0; | |
| 7971 | 207 | tempitem.wpn3 = 0; | |
| 7972 | 207 | tempitem.wpn4 = 0; | |
| 7973 | 207 | tempitem.wpn5 = 0; | |
| 7974 | 207 | tempitem.wpn6 = 0; | |
| 7975 | 207 | tempitem.wpn7 = 0; | |
| 7976 | 207 | tempitem.wpn8 = 0; | |
| 7977 | 207 | tempitem.wpn9 = 0; | |
| 7978 | 207 | tempitem.wpn10 = 0; | |
| 7979 | 207 | break; | |
| 7980 | } | ||
| 7981 | case itype_amulet: | ||
| 7982 | { | ||
| 7983 | 138 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 7984 | 138 | tempitem.misc1 = 0; | |
| 7985 | 138 | tempitem.misc2 = 0; | |
| 7986 | 138 | tempitem.misc3 = 0; | |
| 7987 | 138 | tempitem.misc4 = 0; | |
| 7988 | 138 | tempitem.misc5 = 0; | |
| 7989 | 138 | tempitem.misc6 = 0; | |
| 7990 | 138 | tempitem.misc7 = 0; | |
| 7991 | 138 | tempitem.misc8 = 0; | |
| 7992 | 138 | tempitem.misc9 = 0; | |
| 7993 | 138 | tempitem.misc10 = 0; | |
| 7994 | 138 | tempitem.wpn = 0; | |
| 7995 | 138 | tempitem.wpn2 = 0; | |
| 7996 | 138 | tempitem.wpn3 = 0; | |
| 7997 | 138 | tempitem.wpn4 = 0; | |
| 7998 | 138 | tempitem.wpn5 = 0; | |
| 7999 | 138 | tempitem.wpn6 = 0; | |
| 8000 | 138 | tempitem.wpn7 = 0; | |
| 8001 | 138 | tempitem.wpn8 = 0; | |
| 8002 | 138 | tempitem.wpn9 = 0; | |
| 8003 | 138 | tempitem.wpn10 = 0; | |
| 8004 | 138 | break; | |
| 8005 | } | ||
| 8006 | case itype_shield: | ||
| 8007 | { | ||
| 8008 | 207 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8009 | 207 | tempitem.misc3 = 0; | |
| 8010 | 207 | tempitem.misc4 = 0; | |
| 8011 | 207 | tempitem.misc5 = 0; | |
| 8012 | 207 | tempitem.misc6 = 0; | |
| 8013 | 207 | tempitem.misc7 = 0; | |
| 8014 | 207 | tempitem.misc8 = 0; | |
| 8015 | 207 | tempitem.misc9 = 0; | |
| 8016 | 207 | tempitem.misc10 = 0; | |
| 8017 | 207 | tempitem.wpn = 0; | |
| 8018 | 207 | tempitem.wpn2 = 0; | |
| 8019 | 207 | tempitem.wpn3 = 0; | |
| 8020 | 207 | tempitem.wpn4 = 0; | |
| 8021 | 207 | tempitem.wpn5 = 0; | |
| 8022 | 207 | tempitem.wpn6 = 0; | |
| 8023 | 207 | tempitem.wpn7 = 0; | |
| 8024 | 207 | tempitem.wpn8 = 0; | |
| 8025 | 207 | tempitem.wpn9 = 0; | |
| 8026 | 207 | tempitem.wpn10 = 0; | |
| 8027 | 207 | break; | |
| 8028 | } | ||
| 8029 | case itype_bow: | ||
| 8030 | { | ||
| 8031 | 138 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8032 | 138 | tempitem.misc1 = 0; | |
| 8033 | 138 | tempitem.misc2 = 0; | |
| 8034 | 138 | tempitem.misc3 = 0; | |
| 8035 | 138 | tempitem.misc4 = 0; | |
| 8036 | 138 | tempitem.misc5 = 0; | |
| 8037 | 138 | tempitem.misc6 = 0; | |
| 8038 | 138 | tempitem.misc7 = 0; | |
| 8039 | 138 | tempitem.misc8 = 0; | |
| 8040 | 138 | tempitem.misc9 = 0; | |
| 8041 | 138 | tempitem.misc10 = 0; | |
| 8042 | 138 | tempitem.wpn = 0; | |
| 8043 | 138 | tempitem.wpn2 = 0; | |
| 8044 | 138 | tempitem.wpn3 = 0; | |
| 8045 | 138 | tempitem.wpn4 = 0; | |
| 8046 | 138 | tempitem.wpn5 = 0; | |
| 8047 | 138 | tempitem.wpn6 = 0; | |
| 8048 | 138 | tempitem.wpn7 = 0; | |
| 8049 | 138 | tempitem.wpn8 = 0; | |
| 8050 | 138 | tempitem.wpn9 = 0; | |
| 8051 | 138 | tempitem.wpn10 = 0; | |
| 8052 | 138 | break; | |
| 8053 | } | ||
| 8054 | case itype_raft: | ||
| 8055 | { | ||
| 8056 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8057 | 69 | tempitem.misc1 = 0; | |
| 8058 | 69 | tempitem.misc2 = 0; | |
| 8059 | 69 | tempitem.misc3 = 0; | |
| 8060 | 69 | tempitem.misc4 = 0; | |
| 8061 | 69 | tempitem.misc5 = 0; | |
| 8062 | 69 | tempitem.misc6 = 0; | |
| 8063 | 69 | tempitem.misc7 = 0; | |
| 8064 | 69 | tempitem.misc8 = 0; | |
| 8065 | 69 | tempitem.misc9 = 0; | |
| 8066 | 69 | tempitem.misc10 = 0; | |
| 8067 | 69 | tempitem.wpn = 0; | |
| 8068 | 69 | tempitem.wpn2 = 0; | |
| 8069 | 69 | tempitem.wpn3 = 0; | |
| 8070 | 69 | tempitem.wpn4 = 0; | |
| 8071 | 69 | tempitem.wpn5 = 0; | |
| 8072 | 69 | tempitem.wpn6 = 0; | |
| 8073 | 69 | tempitem.wpn7 = 0; | |
| 8074 | 69 | tempitem.wpn8 = 0; | |
| 8075 | 69 | tempitem.wpn9 = 0; | |
| 8076 | 69 | tempitem.wpn10 = 0; | |
| 8077 | 69 | break; | |
| 8078 | } | ||
| 8079 | case itype_ladder: | ||
| 8080 | { | ||
| 8081 | 138 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8082 | 138 | tempitem.misc1 = 0; | |
| 8083 | 138 | tempitem.misc2 = 0; | |
| 8084 | 138 | tempitem.misc3 = 0; | |
| 8085 | 138 | tempitem.misc4 = 0; | |
| 8086 | 138 | tempitem.misc5 = 0; | |
| 8087 | 138 | tempitem.misc6 = 0; | |
| 8088 | 138 | tempitem.misc7 = 0; | |
| 8089 | 138 | tempitem.misc8 = 0; | |
| 8090 | 138 | tempitem.misc9 = 0; | |
| 8091 | 138 | tempitem.misc10 = 0; | |
| 8092 | 138 | tempitem.wpn = 0; | |
| 8093 | 138 | tempitem.wpn2 = 0; | |
| 8094 | 138 | tempitem.wpn3 = 0; | |
| 8095 | 138 | tempitem.wpn4 = 0; | |
| 8096 | 138 | tempitem.wpn5 = 0; | |
| 8097 | 138 | tempitem.wpn6 = 0; | |
| 8098 | 138 | tempitem.wpn7 = 0; | |
| 8099 | 138 | tempitem.wpn8 = 0; | |
| 8100 | 138 | tempitem.wpn9 = 0; | |
| 8101 | 138 | tempitem.wpn10 = 0; | |
| 8102 | 138 | break; | |
| 8103 | } | ||
| 8104 | case itype_book: | ||
| 8105 | { | ||
| 8106 | 84 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8107 | 84 | tempitem.misc1 = 0; | |
| 8108 | 84 | tempitem.misc2 = 0; | |
| 8109 | 84 | tempitem.misc3 = 0; | |
| 8110 | 84 | tempitem.misc4 = 0; | |
| 8111 | 84 | tempitem.misc5 = 0; | |
| 8112 | 84 | tempitem.misc6 = 0; | |
| 8113 | 84 | tempitem.misc7 = 0; | |
| 8114 | 84 | tempitem.misc8 = 0; | |
| 8115 | 84 | tempitem.misc9 = 0; | |
| 8116 | 84 | tempitem.misc10 = 0; | |
| 8117 | 84 | tempitem.wpn3 = 0; | |
| 8118 | 84 | tempitem.wpn4 = 0; | |
| 8119 | 84 | tempitem.wpn5 = 0; | |
| 8120 | 84 | tempitem.wpn6 = 0; | |
| 8121 | 84 | tempitem.wpn7 = 0; | |
| 8122 | 84 | tempitem.wpn8 = 0; | |
| 8123 | 84 | tempitem.wpn9 = 0; | |
| 8124 | 84 | tempitem.wpn10 = 0; | |
| 8125 | 84 | break; | |
| 8126 | } | ||
| 8127 | case itype_magickey: | ||
| 8128 | { | ||
| 8129 | 69 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8130 | 69 | tempitem.misc1 = 0; | |
| 8131 | 69 | tempitem.misc2 = 0; | |
| 8132 | 69 | tempitem.misc3 = 0; | |
| 8133 | 69 | tempitem.misc4 = 0; | |
| 8134 | 69 | tempitem.misc5 = 0; | |
| 8135 | 69 | tempitem.misc6 = 0; | |
| 8136 | 69 | tempitem.misc7 = 0; | |
| 8137 | 69 | tempitem.misc8 = 0; | |
| 8138 | 69 | tempitem.misc9 = 0; | |
| 8139 | 69 | tempitem.misc10 = 0; | |
| 8140 | 69 | tempitem.wpn = 0; | |
| 8141 | 69 | tempitem.wpn2 = 0; | |
| 8142 | 69 | tempitem.wpn3 = 0; | |
| 8143 | 69 | tempitem.wpn4 = 0; | |
| 8144 | 69 | tempitem.wpn5 = 0; | |
| 8145 | 69 | tempitem.wpn6 = 0; | |
| 8146 | 69 | tempitem.wpn7 = 0; | |
| 8147 | 69 | tempitem.wpn8 = 0; | |
| 8148 | 69 | tempitem.wpn9 = 0; | |
| 8149 | 69 | tempitem.wpn10 = 0; | |
| 8150 | 69 | break; | |
| 8151 | } | ||
| 8152 | case itype_bracelet: | ||
| 8153 | { | ||
| 8154 | 207 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8155 | 207 | tempitem.misc1 = 0; | |
| 8156 | 207 | tempitem.misc2 = 0; | |
| 8157 | 207 | tempitem.misc3 = 0; | |
| 8158 | 207 | tempitem.misc4 = 0; | |
| 8159 | 207 | tempitem.misc5 = 0; | |
| 8160 | 207 | tempitem.misc6 = 0; | |
| 8161 | 207 | tempitem.misc7 = 0; | |
| 8162 | 207 | tempitem.misc8 = 0; | |
| 8163 | 207 | tempitem.misc9 = 0; | |
| 8164 | 207 | tempitem.misc10 = 0; | |
| 8165 | 207 | tempitem.wpn = 0; | |
| 8166 | 207 | tempitem.wpn2 = 0; | |
| 8167 | 207 | tempitem.wpn3 = 0; | |
| 8168 | 207 | tempitem.wpn4 = 0; | |
| 8169 | 207 | tempitem.wpn5 = 0; | |
| 8170 | 207 | tempitem.wpn6 = 0; | |
| 8171 | 207 | tempitem.wpn7 = 0; | |
| 8172 | 207 | tempitem.wpn8 = 0; | |
| 8173 | 207 | tempitem.wpn9 = 0; | |
| 8174 | 207 | tempitem.wpn10 = 0; | |
| 8175 | 207 | break; | |
| 8176 | } | ||
| 8177 | case itype_flippers: | ||
| 8178 | { | ||
| 8179 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8180 | 69 | tempitem.misc1 = 0; | |
| 8181 | 69 | tempitem.misc2 = 0; | |
| 8182 | 69 | tempitem.misc3 = 0; | |
| 8183 | 69 | tempitem.misc4 = 0; | |
| 8184 | 69 | tempitem.misc5 = 0; | |
| 8185 | 69 | tempitem.misc6 = 0; | |
| 8186 | 69 | tempitem.misc7 = 0; | |
| 8187 | 69 | tempitem.misc8 = 0; | |
| 8188 | 69 | tempitem.misc9 = 0; | |
| 8189 | 69 | tempitem.misc10 = 0; | |
| 8190 | 69 | tempitem.wpn = 0; | |
| 8191 | 69 | tempitem.wpn2 = 0; | |
| 8192 | 69 | tempitem.wpn3 = 0; | |
| 8193 | 69 | tempitem.wpn4 = 0; | |
| 8194 | 69 | tempitem.wpn5 = 0; | |
| 8195 | 69 | tempitem.wpn6 = 0; | |
| 8196 | 69 | tempitem.wpn7 = 0; | |
| 8197 | 69 | tempitem.wpn8 = 0; | |
| 8198 | 69 | tempitem.wpn9 = 0; | |
| 8199 | 69 | tempitem.wpn10 = 0; | |
| 8200 | 69 | break; | |
| 8201 | } | ||
| 8202 | case itype_boots: | ||
| 8203 | { | ||
| 8204 | 69 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8205 | 69 | tempitem.misc1 = 0; | |
| 8206 | 69 | tempitem.misc2 = 0; | |
| 8207 | 69 | tempitem.misc3 = 0; | |
| 8208 | 69 | tempitem.misc4 = 0; | |
| 8209 | 69 | tempitem.misc5 = 0; | |
| 8210 | 69 | tempitem.misc6 = 0; | |
| 8211 | 69 | tempitem.misc7 = 0; | |
| 8212 | 69 | tempitem.misc8 = 0; | |
| 8213 | 69 | tempitem.misc9 = 0; | |
| 8214 | 69 | tempitem.misc10 = 0; | |
| 8215 | 69 | tempitem.wpn = 0; | |
| 8216 | 69 | tempitem.wpn2 = 0; | |
| 8217 | 69 | tempitem.wpn3 = 0; | |
| 8218 | 69 | tempitem.wpn4 = 0; | |
| 8219 | 69 | tempitem.wpn5 = 0; | |
| 8220 | 69 | tempitem.wpn6 = 0; | |
| 8221 | 69 | tempitem.wpn7 = 0; | |
| 8222 | 69 | tempitem.wpn8 = 0; | |
| 8223 | 69 | tempitem.wpn9 = 0; | |
| 8224 | 69 | tempitem.wpn10 = 0; | |
| 8225 | 69 | break; | |
| 8226 | } | ||
| 8227 | case itype_hookshot: | ||
| 8228 | { | ||
| 8229 | 138 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8230 | 138 | tempitem.misc5 = 0; | |
| 8231 | 138 | tempitem.misc6 = 0; | |
| 8232 | 138 | tempitem.misc7 = 0; | |
| 8233 | 138 | tempitem.misc8 = 0; | |
| 8234 | 138 | tempitem.misc9 = 0; | |
| 8235 | 138 | tempitem.misc10 = 0; | |
| 8236 | 138 | tempitem.wpn5 = 0; | |
| 8237 | 138 | tempitem.wpn6 = 0; | |
| 8238 | 138 | tempitem.wpn7 = 0; | |
| 8239 | 138 | tempitem.wpn8 = 0; | |
| 8240 | 138 | tempitem.wpn9 = 0; | |
| 8241 | 138 | tempitem.wpn10 = 0; | |
| 8242 | 138 | break; | |
| 8243 | } | ||
| 8244 | case itype_lens: | ||
| 8245 | { | ||
| 8246 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8247 | 69 | tempitem.misc2 = 0; | |
| 8248 | 69 | tempitem.misc3 = 0; | |
| 8249 | 69 | tempitem.misc4 = 0; | |
| 8250 | 69 | tempitem.misc5 = 0; | |
| 8251 | 69 | tempitem.misc6 = 0; | |
| 8252 | 69 | tempitem.misc7 = 0; | |
| 8253 | 69 | tempitem.misc8 = 0; | |
| 8254 | 69 | tempitem.misc9 = 0; | |
| 8255 | 69 | tempitem.misc10 = 0; | |
| 8256 | 69 | tempitem.wpn = 0; | |
| 8257 | 69 | tempitem.wpn2 = 0; | |
| 8258 | 69 | tempitem.wpn3 = 0; | |
| 8259 | 69 | tempitem.wpn4 = 0; | |
| 8260 | 69 | tempitem.wpn5 = 0; | |
| 8261 | 69 | tempitem.wpn6 = 0; | |
| 8262 | 69 | tempitem.wpn7 = 0; | |
| 8263 | 69 | tempitem.wpn8 = 0; | |
| 8264 | 69 | tempitem.wpn9 = 0; | |
| 8265 | 69 | tempitem.wpn10 = 0; | |
| 8266 | 69 | break; | |
| 8267 | } | ||
| 8268 | case itype_hammer: | ||
| 8269 | { | ||
| 8270 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8271 | 69 | tempitem.misc1 = 0; | |
| 8272 | 69 | tempitem.misc2 = 0; | |
| 8273 | 69 | tempitem.misc3 = 0; | |
| 8274 | 69 | tempitem.misc4 = 0; | |
| 8275 | 69 | tempitem.misc5 = 0; | |
| 8276 | 69 | tempitem.misc6 = 0; | |
| 8277 | 69 | tempitem.misc7 = 0; | |
| 8278 | 69 | tempitem.misc8 = 0; | |
| 8279 | 69 | tempitem.misc9 = 0; | |
| 8280 | 69 | tempitem.misc10 = 0; | |
| 8281 | 69 | tempitem.wpn3 = 0; | |
| 8282 | 69 | tempitem.wpn4 = 0; | |
| 8283 | 69 | tempitem.wpn5 = 0; | |
| 8284 | 69 | tempitem.wpn6 = 0; | |
| 8285 | 69 | tempitem.wpn7 = 0; | |
| 8286 | 69 | tempitem.wpn8 = 0; | |
| 8287 | 69 | tempitem.wpn9 = 0; | |
| 8288 | 69 | tempitem.wpn10 = 0; | |
| 8289 | 69 | break; | |
| 8290 | } | ||
| 8291 | case itype_dinsfire: | ||
| 8292 | { | ||
| 8293 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8294 | 69 | tempitem.misc3 = 0; | |
| 8295 | 69 | tempitem.misc4 = 0; | |
| 8296 | 69 | tempitem.misc5 = 0; | |
| 8297 | 69 | tempitem.misc6 = 0; | |
| 8298 | 69 | tempitem.misc7 = 0; | |
| 8299 | 69 | tempitem.misc8 = 0; | |
| 8300 | 69 | tempitem.misc9 = 0; | |
| 8301 | 69 | tempitem.misc10 = 0; | |
| 8302 | 69 | tempitem.wpn6 = 0; | |
| 8303 | 69 | tempitem.wpn7 = 0; | |
| 8304 | 69 | tempitem.wpn8 = 0; | |
| 8305 | 69 | tempitem.wpn9 = 0; | |
| 8306 | 69 | tempitem.wpn10 = 0; | |
| 8307 | 69 | break; | |
| 8308 | } | ||
| 8309 | case itype_faroreswind: | ||
| 8310 | { | ||
| 8311 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8312 | 69 | tempitem.misc2 = 0; | |
| 8313 | 69 | tempitem.misc3 = 0; | |
| 8314 | 69 | tempitem.misc4 = 0; | |
| 8315 | 69 | tempitem.misc5 = 0; | |
| 8316 | 69 | tempitem.misc6 = 0; | |
| 8317 | 69 | tempitem.misc7 = 0; | |
| 8318 | 69 | tempitem.misc8 = 0; | |
| 8319 | 69 | tempitem.misc9 = 0; | |
| 8320 | 69 | tempitem.misc10 = 0; | |
| 8321 | 69 | tempitem.wpn = 0; | |
| 8322 | 69 | tempitem.wpn2 = 0; | |
| 8323 | 69 | tempitem.wpn3 = 0; | |
| 8324 | 69 | tempitem.wpn4 = 0; | |
| 8325 | 69 | tempitem.wpn5 = 0; | |
| 8326 | 69 | tempitem.wpn6 = 0; | |
| 8327 | 69 | tempitem.wpn7 = 0; | |
| 8328 | 69 | tempitem.wpn8 = 0; | |
| 8329 | 69 | tempitem.wpn9 = 0; | |
| 8330 | 69 | tempitem.wpn10 = 0; | |
| 8331 | 69 | break; | |
| 8332 | } | ||
| 8333 | case itype_nayruslove: | ||
| 8334 | { | ||
| 8335 | 69 | tempitem.flags &= ~ (ITEM_FLAG5); | |
| 8336 | 69 | tempitem.misc2 = 0; | |
| 8337 | 69 | tempitem.misc3 = 0; | |
| 8338 | 69 | tempitem.misc4 = 0; | |
| 8339 | 69 | tempitem.misc5 = 0; | |
| 8340 | 69 | tempitem.misc6 = 0; | |
| 8341 | 69 | tempitem.misc7 = 0; | |
| 8342 | 69 | tempitem.misc8 = 0; | |
| 8343 | 69 | tempitem.misc9 = 0; | |
| 8344 | 69 | tempitem.misc10 = 0; | |
| 8345 | 69 | break; | |
| 8346 | } | ||
| 8347 | case itype_bomb: | ||
| 8348 | { | ||
| 8349 | 84 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8350 | 84 | tempitem.misc4 = 0; | |
| 8351 | 84 | tempitem.misc5 = 0; | |
| 8352 | 84 | tempitem.misc6 = 0; | |
| 8353 | 84 | tempitem.misc7 = 0; | |
| 8354 | 84 | tempitem.misc8 = 0; | |
| 8355 | 84 | tempitem.misc9 = 0; | |
| 8356 | 84 | tempitem.misc10 = 0; | |
| 8357 | 84 | tempitem.wpn3 = 0; | |
| 8358 | 84 | tempitem.wpn4 = 0; | |
| 8359 | 84 | tempitem.wpn5 = 0; | |
| 8360 | 84 | tempitem.wpn6 = 0; | |
| 8361 | 84 | tempitem.wpn7 = 0; | |
| 8362 | 84 | tempitem.wpn8 = 0; | |
| 8363 | 84 | tempitem.wpn9 = 0; | |
| 8364 | 84 | tempitem.wpn10 = 0; | |
| 8365 | 84 | break; | |
| 8366 | } | ||
| 8367 | case itype_sbomb: | ||
| 8368 | { | ||
| 8369 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8370 | 69 | tempitem.misc4 = 0; | |
| 8371 | 69 | tempitem.misc5 = 0; | |
| 8372 | 69 | tempitem.misc6 = 0; | |
| 8373 | 69 | tempitem.misc7 = 0; | |
| 8374 | 69 | tempitem.misc8 = 0; | |
| 8375 | 69 | tempitem.misc9 = 0; | |
| 8376 | 69 | tempitem.misc10 = 0; | |
| 8377 | 69 | tempitem.wpn3 = 0; | |
| 8378 | 69 | tempitem.wpn4 = 0; | |
| 8379 | 69 | tempitem.wpn5 = 0; | |
| 8380 | 69 | tempitem.wpn6 = 0; | |
| 8381 | 69 | tempitem.wpn7 = 0; | |
| 8382 | 69 | tempitem.wpn8 = 0; | |
| 8383 | 69 | tempitem.wpn9 = 0; | |
| 8384 | 69 | tempitem.wpn10 = 0; | |
| 8385 | 69 | break; | |
| 8386 | } | ||
| 8387 | case itype_clock: | ||
| 8388 | { | ||
| 8389 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8390 | 69 | tempitem.misc2 = 0; | |
| 8391 | 69 | tempitem.misc3 = 0; | |
| 8392 | 69 | tempitem.misc4 = 0; | |
| 8393 | 69 | tempitem.misc5 = 0; | |
| 8394 | 69 | tempitem.misc6 = 0; | |
| 8395 | 69 | tempitem.misc7 = 0; | |
| 8396 | 69 | tempitem.misc8 = 0; | |
| 8397 | 69 | tempitem.misc9 = 0; | |
| 8398 | 69 | tempitem.misc10 = 0; | |
| 8399 | 69 | tempitem.wpn = 0; | |
| 8400 | 69 | tempitem.wpn2 = 0; | |
| 8401 | 69 | tempitem.wpn3 = 0; | |
| 8402 | 69 | tempitem.wpn4 = 0; | |
| 8403 | 69 | tempitem.wpn5 = 0; | |
| 8404 | 69 | tempitem.wpn6 = 0; | |
| 8405 | 69 | tempitem.wpn7 = 0; | |
| 8406 | 69 | tempitem.wpn8 = 0; | |
| 8407 | 69 | tempitem.wpn9 = 0; | |
| 8408 | 69 | tempitem.wpn10 = 0; | |
| 8409 | 69 | break; | |
| 8410 | } | ||
| 8411 | case itype_key: | ||
| 8412 | { | ||
| 8413 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8414 | 69 | tempitem.misc1 = 0; | |
| 8415 | 69 | tempitem.misc2 = 0; | |
| 8416 | 69 | tempitem.misc3 = 0; | |
| 8417 | 69 | tempitem.misc4 = 0; | |
| 8418 | 69 | tempitem.misc5 = 0; | |
| 8419 | 69 | tempitem.misc6 = 0; | |
| 8420 | 69 | tempitem.misc7 = 0; | |
| 8421 | 69 | tempitem.misc8 = 0; | |
| 8422 | 69 | tempitem.misc9 = 0; | |
| 8423 | 69 | tempitem.misc10 = 0; | |
| 8424 | 69 | tempitem.wpn = 0; | |
| 8425 | 69 | tempitem.wpn2 = 0; | |
| 8426 | 69 | tempitem.wpn3 = 0; | |
| 8427 | 69 | tempitem.wpn4 = 0; | |
| 8428 | 69 | tempitem.wpn5 = 0; | |
| 8429 | 69 | tempitem.wpn6 = 0; | |
| 8430 | 69 | tempitem.wpn7 = 0; | |
| 8431 | 69 | tempitem.wpn8 = 0; | |
| 8432 | 69 | tempitem.wpn9 = 0; | |
| 8433 | 69 | tempitem.wpn10 = 0; | |
| 8434 | 69 | break; | |
| 8435 | } | ||
| 8436 | case itype_magiccontainer: | ||
| 8437 | { | ||
| 8438 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8439 | 69 | tempitem.misc1 = 0; | |
| 8440 | 69 | tempitem.misc2 = 0; | |
| 8441 | 69 | tempitem.misc3 = 0; | |
| 8442 | 69 | tempitem.misc4 = 0; | |
| 8443 | 69 | tempitem.misc5 = 0; | |
| 8444 | 69 | tempitem.misc6 = 0; | |
| 8445 | 69 | tempitem.misc7 = 0; | |
| 8446 | 69 | tempitem.misc8 = 0; | |
| 8447 | 69 | tempitem.misc9 = 0; | |
| 8448 | 69 | tempitem.misc10 = 0; | |
| 8449 | 69 | tempitem.wpn = 0; | |
| 8450 | 69 | tempitem.wpn2 = 0; | |
| 8451 | 69 | tempitem.wpn3 = 0; | |
| 8452 | 69 | tempitem.wpn4 = 0; | |
| 8453 | 69 | tempitem.wpn5 = 0; | |
| 8454 | 69 | tempitem.wpn6 = 0; | |
| 8455 | 69 | tempitem.wpn7 = 0; | |
| 8456 | 69 | tempitem.wpn8 = 0; | |
| 8457 | 69 | tempitem.wpn9 = 0; | |
| 8458 | 69 | tempitem.wpn10 = 0; | |
| 8459 | 69 | break; | |
| 8460 | } | ||
| 8461 | case itype_triforcepiece: | ||
| 8462 | { | ||
| 8463 | 138 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8464 | 138 | tempitem.misc3 = 0; | |
| 8465 | 138 | tempitem.misc4 = 0; | |
| 8466 | 138 | tempitem.misc5 = 0; | |
| 8467 | 138 | tempitem.misc6 = 0; | |
| 8468 | 138 | tempitem.misc7 = 0; | |
| 8469 | 138 | tempitem.misc8 = 0; | |
| 8470 | 138 | tempitem.misc9 = 0; | |
| 8471 | 138 | tempitem.misc10 = 0; | |
| 8472 | 138 | tempitem.wpn = 0; | |
| 8473 | 138 | tempitem.wpn2 = 0; | |
| 8474 | 138 | tempitem.wpn3 = 0; | |
| 8475 | 138 | tempitem.wpn4 = 0; | |
| 8476 | 138 | tempitem.wpn5 = 0; | |
| 8477 | 138 | tempitem.wpn6 = 0; | |
| 8478 | 138 | tempitem.wpn7 = 0; | |
| 8479 | 138 | tempitem.wpn8 = 0; | |
| 8480 | 138 | tempitem.wpn9 = 0; | |
| 8481 | 138 | tempitem.wpn10 = 0; | |
| 8482 | 138 | break; | |
| 8483 | } | ||
| 8484 | case itype_map: case itype_compass: case itype_bosskey: | ||
| 8485 | { | ||
| 8486 | 207 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8487 | 207 | tempitem.misc1 = 0; | |
| 8488 | 207 | tempitem.misc2 = 0; | |
| 8489 | 207 | tempitem.misc3 = 0; | |
| 8490 | 207 | tempitem.misc4 = 0; | |
| 8491 | 207 | tempitem.misc5 = 0; | |
| 8492 | 207 | tempitem.misc6 = 0; | |
| 8493 | 207 | tempitem.misc7 = 0; | |
| 8494 | 207 | tempitem.misc8 = 0; | |
| 8495 | 207 | tempitem.misc9 = 0; | |
| 8496 | 207 | tempitem.misc10 = 0; | |
| 8497 | 207 | tempitem.wpn = 0; | |
| 8498 | 207 | tempitem.wpn2 = 0; | |
| 8499 | 207 | tempitem.wpn3 = 0; | |
| 8500 | 207 | tempitem.wpn4 = 0; | |
| 8501 | 207 | tempitem.wpn5 = 0; | |
| 8502 | 207 | tempitem.wpn6 = 0; | |
| 8503 | 207 | tempitem.wpn7 = 0; | |
| 8504 | 207 | tempitem.wpn8 = 0; | |
| 8505 | 207 | tempitem.wpn9 = 0; | |
| 8506 | 207 | tempitem.wpn10 = 0; | |
| 8507 | 207 | break; | |
| 8508 | } | ||
| 8509 | case itype_quiver: | ||
| 8510 | { | ||
| 8511 | 276 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8512 | 276 | tempitem.misc3 = 0; | |
| 8513 | 276 | tempitem.misc4 = 0; | |
| 8514 | 276 | tempitem.misc5 = 0; | |
| 8515 | 276 | tempitem.misc6 = 0; | |
| 8516 | 276 | tempitem.misc7 = 0; | |
| 8517 | 276 | tempitem.misc8 = 0; | |
| 8518 | 276 | tempitem.misc9 = 0; | |
| 8519 | 276 | tempitem.misc10 = 0; | |
| 8520 | 276 | tempitem.wpn = 0; | |
| 8521 | 276 | tempitem.wpn2 = 0; | |
| 8522 | 276 | tempitem.wpn3 = 0; | |
| 8523 | 276 | tempitem.wpn4 = 0; | |
| 8524 | 276 | tempitem.wpn5 = 0; | |
| 8525 | 276 | tempitem.wpn6 = 0; | |
| 8526 | 276 | tempitem.wpn7 = 0; | |
| 8527 | 276 | tempitem.wpn8 = 0; | |
| 8528 | 276 | tempitem.wpn9 = 0; | |
| 8529 | 276 | tempitem.wpn10 = 0; | |
| 8530 | 276 | break; | |
| 8531 | } | ||
| 8532 | case itype_lkey: | ||
| 8533 | { | ||
| 8534 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8535 | 69 | tempitem.misc1 = 0; | |
| 8536 | 69 | tempitem.misc2 = 0; | |
| 8537 | 69 | tempitem.misc3 = 0; | |
| 8538 | 69 | tempitem.misc4 = 0; | |
| 8539 | 69 | tempitem.misc5 = 0; | |
| 8540 | 69 | tempitem.misc6 = 0; | |
| 8541 | 69 | tempitem.misc7 = 0; | |
| 8542 | 69 | tempitem.misc8 = 0; | |
| 8543 | 69 | tempitem.misc9 = 0; | |
| 8544 | 69 | tempitem.misc10 = 0; | |
| 8545 | 69 | tempitem.wpn = 0; | |
| 8546 | 69 | tempitem.wpn2 = 0; | |
| 8547 | 69 | tempitem.wpn3 = 0; | |
| 8548 | 69 | tempitem.wpn4 = 0; | |
| 8549 | 69 | tempitem.wpn5 = 0; | |
| 8550 | 69 | tempitem.wpn6 = 0; | |
| 8551 | 69 | tempitem.wpn7 = 0; | |
| 8552 | 69 | tempitem.wpn8 = 0; | |
| 8553 | 69 | tempitem.wpn9 = 0; | |
| 8554 | 69 | tempitem.wpn10 = 0; | |
| 8555 | 69 | break; | |
| 8556 | } | ||
| 8557 | case itype_cbyrna: | ||
| 8558 | { | ||
| 8559 | 69 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG5); | |
| 8560 | 69 | tempitem.misc4 = 0; | |
| 8561 | 69 | tempitem.misc5 = 0; | |
| 8562 | 69 | tempitem.misc6 = 0; | |
| 8563 | 69 | tempitem.misc7 = 0; | |
| 8564 | 69 | tempitem.misc8 = 0; | |
| 8565 | 69 | tempitem.misc9 = 0; | |
| 8566 | 69 | tempitem.misc10 = 0; | |
| 8567 | 69 | tempitem.wpn6 = 0; | |
| 8568 | 69 | tempitem.wpn7 = 0; | |
| 8569 | 69 | tempitem.wpn8 = 0; | |
| 8570 | 69 | tempitem.wpn9 = 0; | |
| 8571 | 69 | tempitem.wpn10 = 0; | |
| 8572 | 69 | break; | |
| 8573 | } | ||
| 8574 | case itype_rupee: case itype_arrowammo: | ||
| 8575 | { | ||
| 8576 | 881 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8577 | 881 | tempitem.misc1 = 0; | |
| 8578 | 881 | tempitem.misc2 = 0; | |
| 8579 | 881 | tempitem.misc3 = 0; | |
| 8580 | 881 | tempitem.misc4 = 0; | |
| 8581 | 881 | tempitem.misc5 = 0; | |
| 8582 | 881 | tempitem.misc6 = 0; | |
| 8583 | 881 | tempitem.misc7 = 0; | |
| 8584 | 881 | tempitem.misc8 = 0; | |
| 8585 | 881 | tempitem.misc9 = 0; | |
| 8586 | 881 | tempitem.misc10 = 0; | |
| 8587 | 881 | tempitem.wpn = 0; | |
| 8588 | 881 | tempitem.wpn2 = 0; | |
| 8589 | 881 | tempitem.wpn3 = 0; | |
| 8590 | 881 | tempitem.wpn4 = 0; | |
| 8591 | 881 | tempitem.wpn5 = 0; | |
| 8592 | 881 | tempitem.wpn6 = 0; | |
| 8593 | 881 | tempitem.wpn7 = 0; | |
| 8594 | 881 | tempitem.wpn8 = 0; | |
| 8595 | 881 | tempitem.wpn9 = 0; | |
| 8596 | 881 | tempitem.wpn10 = 0; | |
| 8597 | 881 | break; | |
| 8598 | } | ||
| 8599 | case itype_fairy: | ||
| 8600 | { | ||
| 8601 | 120 | tempitem.flags &= ~ (ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8602 | 120 | tempitem.misc4 = 0; | |
| 8603 | 120 | tempitem.misc5 = 0; | |
| 8604 | 120 | tempitem.misc6 = 0; | |
| 8605 | 120 | tempitem.misc7 = 0; | |
| 8606 | 120 | tempitem.misc8 = 0; | |
| 8607 | 120 | tempitem.misc9 = 0; | |
| 8608 | 120 | tempitem.misc10 = 0; | |
| 8609 | 120 | tempitem.wpn = 0; | |
| 8610 | 120 | tempitem.wpn2 = 0; | |
| 8611 | 120 | tempitem.wpn3 = 0; | |
| 8612 | 120 | tempitem.wpn4 = 0; | |
| 8613 | 120 | tempitem.wpn5 = 0; | |
| 8614 | 120 | tempitem.wpn6 = 0; | |
| 8615 | 120 | tempitem.wpn7 = 0; | |
| 8616 | 120 | tempitem.wpn8 = 0; | |
| 8617 | 120 | tempitem.wpn9 = 0; | |
| 8618 | 120 | tempitem.wpn10 = 0; | |
| 8619 | 120 | break; | |
| 8620 | } | ||
| 8621 | case itype_magic: case itype_heart: case itype_heartcontainer: case itype_heartpiece: case itype_killem: case itype_bombammo: | ||
| 8622 | { | ||
| 8623 | 746 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8624 | 746 | tempitem.misc1 = 0; | |
| 8625 | 746 | tempitem.misc2 = 0; | |
| 8626 | 746 | tempitem.misc3 = 0; | |
| 8627 | 746 | tempitem.misc4 = 0; | |
| 8628 | 746 | tempitem.misc5 = 0; | |
| 8629 | 746 | tempitem.misc6 = 0; | |
| 8630 | 746 | tempitem.misc7 = 0; | |
| 8631 | 746 | tempitem.misc8 = 0; | |
| 8632 | 746 | tempitem.misc9 = 0; | |
| 8633 | 746 | tempitem.misc10 = 0; | |
| 8634 | 746 | tempitem.wpn = 0; | |
| 8635 | 746 | tempitem.wpn2 = 0; | |
| 8636 | 746 | tempitem.wpn3 = 0; | |
| 8637 | 746 | tempitem.wpn4 = 0; | |
| 8638 | 746 | tempitem.wpn5 = 0; | |
| 8639 | 746 | tempitem.wpn6 = 0; | |
| 8640 | 746 | tempitem.wpn7 = 0; | |
| 8641 | 746 | tempitem.wpn8 = 0; | |
| 8642 | 746 | tempitem.wpn9 = 0; | |
| 8643 | 746 | tempitem.wpn10 = 0; | |
| 8644 | 746 | break; | |
| 8645 | } | ||
| 8646 | case itype_bombbag: | ||
| 8647 | { | ||
| 8648 | 276 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8649 | 276 | tempitem.misc3 = 0; | |
| 8650 | 276 | tempitem.misc4 = 0; | |
| 8651 | 276 | tempitem.misc5 = 0; | |
| 8652 | 276 | tempitem.misc6 = 0; | |
| 8653 | 276 | tempitem.misc7 = 0; | |
| 8654 | 276 | tempitem.misc8 = 0; | |
| 8655 | 276 | tempitem.misc9 = 0; | |
| 8656 | 276 | tempitem.misc10 = 0; | |
| 8657 | 276 | tempitem.wpn = 0; | |
| 8658 | 276 | tempitem.wpn2 = 0; | |
| 8659 | 276 | tempitem.wpn3 = 0; | |
| 8660 | 276 | tempitem.wpn4 = 0; | |
| 8661 | 276 | tempitem.wpn5 = 0; | |
| 8662 | 276 | tempitem.wpn6 = 0; | |
| 8663 | 276 | tempitem.wpn7 = 0; | |
| 8664 | 276 | tempitem.wpn8 = 0; | |
| 8665 | 276 | tempitem.wpn9 = 0; | |
| 8666 | 276 | tempitem.wpn10 = 0; | |
| 8667 | 276 | break; | |
| 8668 | } | ||
| 8669 | case itype_rocs: | ||
| 8670 | { | ||
| 8671 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8672 | 69 | tempitem.misc1 = 0; | |
| 8673 | 69 | tempitem.misc2 = 0; | |
| 8674 | 69 | tempitem.misc3 = 0; | |
| 8675 | 69 | tempitem.misc4 = 0; | |
| 8676 | 69 | tempitem.misc5 = 0; | |
| 8677 | 69 | tempitem.misc6 = 0; | |
| 8678 | 69 | tempitem.misc7 = 0; | |
| 8679 | 69 | tempitem.misc8 = 0; | |
| 8680 | 69 | tempitem.misc9 = 0; | |
| 8681 | 69 | tempitem.misc10 = 0; | |
| 8682 | 69 | tempitem.wpn = 0; | |
| 8683 | 69 | tempitem.wpn2 = 0; | |
| 8684 | 69 | tempitem.wpn3 = 0; | |
| 8685 | 69 | tempitem.wpn4 = 0; | |
| 8686 | 69 | tempitem.wpn5 = 0; | |
| 8687 | 69 | tempitem.wpn6 = 0; | |
| 8688 | 69 | tempitem.wpn7 = 0; | |
| 8689 | 69 | tempitem.wpn8 = 0; | |
| 8690 | 69 | tempitem.wpn9 = 0; | |
| 8691 | 69 | tempitem.wpn10 = 0; | |
| 8692 | 69 | break; | |
| 8693 | } | ||
| 8694 | case itype_hoverboots: | ||
| 8695 | { | ||
| 8696 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8697 | 69 | tempitem.misc2 = 0; | |
| 8698 | 69 | tempitem.misc3 = 0; | |
| 8699 | 69 | tempitem.misc4 = 0; | |
| 8700 | 69 | tempitem.misc5 = 0; | |
| 8701 | 69 | tempitem.misc6 = 0; | |
| 8702 | 69 | tempitem.misc7 = 0; | |
| 8703 | 69 | tempitem.misc8 = 0; | |
| 8704 | 69 | tempitem.misc9 = 0; | |
| 8705 | 69 | tempitem.misc10 = 0; | |
| 8706 | 69 | tempitem.wpn2 = 0; | |
| 8707 | 69 | tempitem.wpn3 = 0; | |
| 8708 | 69 | tempitem.wpn4 = 0; | |
| 8709 | 69 | tempitem.wpn5 = 0; | |
| 8710 | 69 | tempitem.wpn6 = 0; | |
| 8711 | 69 | tempitem.wpn7 = 0; | |
| 8712 | 69 | tempitem.wpn8 = 0; | |
| 8713 | 69 | tempitem.wpn9 = 0; | |
| 8714 | 69 | tempitem.wpn10 = 0; | |
| 8715 | 69 | break; | |
| 8716 | } | ||
| 8717 | case itype_spinscroll: | ||
| 8718 | { | ||
| 8719 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8720 | 69 | tempitem.misc2 = 0; | |
| 8721 | 69 | tempitem.misc3 = 0; | |
| 8722 | 69 | tempitem.misc4 = 0; | |
| 8723 | 69 | tempitem.misc5 = 0; | |
| 8724 | 69 | tempitem.misc6 = 0; | |
| 8725 | 69 | tempitem.misc7 = 0; | |
| 8726 | 69 | tempitem.misc8 = 0; | |
| 8727 | 69 | tempitem.misc9 = 0; | |
| 8728 | 69 | tempitem.misc10 = 0; | |
| 8729 | 69 | tempitem.wpn = 0; | |
| 8730 | 69 | tempitem.wpn2 = 0; | |
| 8731 | 69 | tempitem.wpn3 = 0; | |
| 8732 | 69 | tempitem.wpn4 = 0; | |
| 8733 | 69 | tempitem.wpn5 = 0; | |
| 8734 | 69 | tempitem.wpn6 = 0; | |
| 8735 | 69 | tempitem.wpn7 = 0; | |
| 8736 | 69 | tempitem.wpn8 = 0; | |
| 8737 | 69 | tempitem.wpn9 = 0; | |
| 8738 | 69 | tempitem.wpn10 = 0; | |
| 8739 | 69 | break; | |
| 8740 | } | ||
| 8741 | case itype_crossscroll: | ||
| 8742 | { | ||
| 8743 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8744 | 69 | tempitem.misc1 = 0; | |
| 8745 | 69 | tempitem.misc2 = 0; | |
| 8746 | 69 | tempitem.misc3 = 0; | |
| 8747 | 69 | tempitem.misc4 = 0; | |
| 8748 | 69 | tempitem.misc5 = 0; | |
| 8749 | 69 | tempitem.misc6 = 0; | |
| 8750 | 69 | tempitem.misc7 = 0; | |
| 8751 | 69 | tempitem.misc8 = 0; | |
| 8752 | 69 | tempitem.misc9 = 0; | |
| 8753 | 69 | tempitem.misc10 = 0; | |
| 8754 | 69 | tempitem.wpn = 0; | |
| 8755 | 69 | tempitem.wpn2 = 0; | |
| 8756 | 69 | tempitem.wpn3 = 0; | |
| 8757 | 69 | tempitem.wpn4 = 0; | |
| 8758 | 69 | tempitem.wpn5 = 0; | |
| 8759 | 69 | tempitem.wpn6 = 0; | |
| 8760 | 69 | tempitem.wpn7 = 0; | |
| 8761 | 69 | tempitem.wpn8 = 0; | |
| 8762 | 69 | tempitem.wpn9 = 0; | |
| 8763 | 69 | tempitem.wpn10 = 0; | |
| 8764 | 69 | break; | |
| 8765 | } | ||
| 8766 | case itype_quakescroll: | ||
| 8767 | { | ||
| 8768 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8769 | 69 | tempitem.misc3 = 0; | |
| 8770 | 69 | tempitem.misc4 = 0; | |
| 8771 | 69 | tempitem.misc5 = 0; | |
| 8772 | 69 | tempitem.misc6 = 0; | |
| 8773 | 69 | tempitem.misc7 = 0; | |
| 8774 | 69 | tempitem.misc8 = 0; | |
| 8775 | 69 | tempitem.misc9 = 0; | |
| 8776 | 69 | tempitem.misc10 = 0; | |
| 8777 | 69 | tempitem.wpn = 0; | |
| 8778 | 69 | tempitem.wpn2 = 0; | |
| 8779 | 69 | tempitem.wpn3 = 0; | |
| 8780 | 69 | tempitem.wpn4 = 0; | |
| 8781 | 69 | tempitem.wpn5 = 0; | |
| 8782 | 69 | tempitem.wpn6 = 0; | |
| 8783 | 69 | tempitem.wpn7 = 0; | |
| 8784 | 69 | tempitem.wpn8 = 0; | |
| 8785 | 69 | tempitem.wpn9 = 0; | |
| 8786 | 69 | tempitem.wpn10 = 0; | |
| 8787 | 69 | break; | |
| 8788 | } | ||
| 8789 | case itype_whispring: | ||
| 8790 | { | ||
| 8791 | 138 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8792 | 138 | tempitem.misc2 = 0; | |
| 8793 | 138 | tempitem.misc3 = 0; | |
| 8794 | 138 | tempitem.misc4 = 0; | |
| 8795 | 138 | tempitem.misc5 = 0; | |
| 8796 | 138 | tempitem.misc6 = 0; | |
| 8797 | 138 | tempitem.misc7 = 0; | |
| 8798 | 138 | tempitem.misc8 = 0; | |
| 8799 | 138 | tempitem.misc9 = 0; | |
| 8800 | 138 | tempitem.misc10 = 0; | |
| 8801 | 138 | tempitem.wpn = 0; | |
| 8802 | 138 | tempitem.wpn2 = 0; | |
| 8803 | 138 | tempitem.wpn3 = 0; | |
| 8804 | 138 | tempitem.wpn4 = 0; | |
| 8805 | 138 | tempitem.wpn5 = 0; | |
| 8806 | 138 | tempitem.wpn6 = 0; | |
| 8807 | 138 | tempitem.wpn7 = 0; | |
| 8808 | 138 | tempitem.wpn8 = 0; | |
| 8809 | 138 | tempitem.wpn9 = 0; | |
| 8810 | 138 | tempitem.wpn10 = 0; | |
| 8811 | 138 | break; | |
| 8812 | } | ||
| 8813 | case itype_chargering: | ||
| 8814 | { | ||
| 8815 | 138 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8816 | 138 | tempitem.misc3 = 0; | |
| 8817 | 138 | tempitem.misc4 = 0; | |
| 8818 | 138 | tempitem.misc5 = 0; | |
| 8819 | 138 | tempitem.misc6 = 0; | |
| 8820 | 138 | tempitem.misc7 = 0; | |
| 8821 | 138 | tempitem.misc8 = 0; | |
| 8822 | 138 | tempitem.misc9 = 0; | |
| 8823 | 138 | tempitem.misc10 = 0; | |
| 8824 | 138 | tempitem.wpn = 0; | |
| 8825 | 138 | tempitem.wpn2 = 0; | |
| 8826 | 138 | tempitem.wpn3 = 0; | |
| 8827 | 138 | tempitem.wpn4 = 0; | |
| 8828 | 138 | tempitem.wpn5 = 0; | |
| 8829 | 138 | tempitem.wpn6 = 0; | |
| 8830 | 138 | tempitem.wpn7 = 0; | |
| 8831 | 138 | tempitem.wpn8 = 0; | |
| 8832 | 138 | tempitem.wpn9 = 0; | |
| 8833 | 138 | tempitem.wpn10 = 0; | |
| 8834 | 138 | break; | |
| 8835 | } | ||
| 8836 | case itype_perilscroll: | ||
| 8837 | { | ||
| 8838 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8839 | 69 | tempitem.misc2 = 0; | |
| 8840 | 69 | tempitem.misc3 = 0; | |
| 8841 | 69 | tempitem.misc4 = 0; | |
| 8842 | 69 | tempitem.misc5 = 0; | |
| 8843 | 69 | tempitem.misc6 = 0; | |
| 8844 | 69 | tempitem.misc7 = 0; | |
| 8845 | 69 | tempitem.misc8 = 0; | |
| 8846 | 69 | tempitem.misc9 = 0; | |
| 8847 | 69 | tempitem.misc10 = 0; | |
| 8848 | 69 | tempitem.wpn = 0; | |
| 8849 | 69 | tempitem.wpn2 = 0; | |
| 8850 | 69 | tempitem.wpn3 = 0; | |
| 8851 | 69 | tempitem.wpn4 = 0; | |
| 8852 | 69 | tempitem.wpn5 = 0; | |
| 8853 | 69 | tempitem.wpn6 = 0; | |
| 8854 | 69 | tempitem.wpn7 = 0; | |
| 8855 | 69 | tempitem.wpn8 = 0; | |
| 8856 | 69 | tempitem.wpn9 = 0; | |
| 8857 | 69 | tempitem.wpn10 = 0; | |
| 8858 | 69 | break; | |
| 8859 | } | ||
| 8860 | case itype_wealthmedal: | ||
| 8861 | { | ||
| 8862 | 207 | tempitem.flags &= ~ (ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8863 | 207 | tempitem.misc2 = 0; | |
| 8864 | 207 | tempitem.misc3 = 0; | |
| 8865 | 207 | tempitem.misc4 = 0; | |
| 8866 | 207 | tempitem.misc5 = 0; | |
| 8867 | 207 | tempitem.misc6 = 0; | |
| 8868 | 207 | tempitem.misc7 = 0; | |
| 8869 | 207 | tempitem.misc8 = 0; | |
| 8870 | 207 | tempitem.misc9 = 0; | |
| 8871 | 207 | tempitem.misc10 = 0; | |
| 8872 | 207 | tempitem.wpn = 0; | |
| 8873 | 207 | tempitem.wpn2 = 0; | |
| 8874 | 207 | tempitem.wpn3 = 0; | |
| 8875 | 207 | tempitem.wpn4 = 0; | |
| 8876 | 207 | tempitem.wpn5 = 0; | |
| 8877 | 207 | tempitem.wpn6 = 0; | |
| 8878 | 207 | tempitem.wpn7 = 0; | |
| 8879 | 207 | tempitem.wpn8 = 0; | |
| 8880 | 207 | tempitem.wpn9 = 0; | |
| 8881 | 207 | tempitem.wpn10 = 0; | |
| 8882 | 207 | break; | |
| 8883 | } | ||
| 8884 | case itype_heartring: | ||
| 8885 | { | ||
| 8886 | 207 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8887 | 207 | tempitem.misc3 = 0; | |
| 8888 | 207 | tempitem.misc4 = 0; | |
| 8889 | 207 | tempitem.misc5 = 0; | |
| 8890 | 207 | tempitem.misc6 = 0; | |
| 8891 | 207 | tempitem.misc7 = 0; | |
| 8892 | 207 | tempitem.misc8 = 0; | |
| 8893 | 207 | tempitem.misc9 = 0; | |
| 8894 | 207 | tempitem.misc10 = 0; | |
| 8895 | 207 | tempitem.wpn = 0; | |
| 8896 | 207 | tempitem.wpn2 = 0; | |
| 8897 | 207 | tempitem.wpn3 = 0; | |
| 8898 | 207 | tempitem.wpn4 = 0; | |
| 8899 | 207 | tempitem.wpn5 = 0; | |
| 8900 | 207 | tempitem.wpn6 = 0; | |
| 8901 | 207 | tempitem.wpn7 = 0; | |
| 8902 | 207 | tempitem.wpn8 = 0; | |
| 8903 | 207 | tempitem.wpn9 = 0; | |
| 8904 | 207 | tempitem.wpn10 = 0; | |
| 8905 | 207 | break; | |
| 8906 | } | ||
| 8907 | case itype_magicring: | ||
| 8908 | { | ||
| 8909 | 276 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8910 | 276 | tempitem.misc3 = 0; | |
| 8911 | 276 | tempitem.misc4 = 0; | |
| 8912 | 276 | tempitem.misc5 = 0; | |
| 8913 | 276 | tempitem.misc6 = 0; | |
| 8914 | 276 | tempitem.misc7 = 0; | |
| 8915 | 276 | tempitem.misc8 = 0; | |
| 8916 | 276 | tempitem.misc9 = 0; | |
| 8917 | 276 | tempitem.misc10 = 0; | |
| 8918 | 276 | tempitem.wpn = 0; | |
| 8919 | 276 | tempitem.wpn2 = 0; | |
| 8920 | 276 | tempitem.wpn3 = 0; | |
| 8921 | 276 | tempitem.wpn4 = 0; | |
| 8922 | 276 | tempitem.wpn5 = 0; | |
| 8923 | 276 | tempitem.wpn6 = 0; | |
| 8924 | 276 | tempitem.wpn7 = 0; | |
| 8925 | 276 | tempitem.wpn8 = 0; | |
| 8926 | 276 | tempitem.wpn9 = 0; | |
| 8927 | 276 | tempitem.wpn10 = 0; | |
| 8928 | 276 | break; | |
| 8929 | } | ||
| 8930 | case itype_spinscroll2: | ||
| 8931 | { | ||
| 8932 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8933 | 69 | tempitem.misc2 = 0; | |
| 8934 | 69 | tempitem.misc3 = 0; | |
| 8935 | 69 | tempitem.misc4 = 0; | |
| 8936 | 69 | tempitem.misc5 = 0; | |
| 8937 | 69 | tempitem.misc6 = 0; | |
| 8938 | 69 | tempitem.misc7 = 0; | |
| 8939 | 69 | tempitem.misc8 = 0; | |
| 8940 | 69 | tempitem.misc9 = 0; | |
| 8941 | 69 | tempitem.misc10 = 0; | |
| 8942 | 69 | tempitem.wpn = 0; | |
| 8943 | 69 | tempitem.wpn2 = 0; | |
| 8944 | 69 | tempitem.wpn3 = 0; | |
| 8945 | 69 | tempitem.wpn4 = 0; | |
| 8946 | 69 | tempitem.wpn5 = 0; | |
| 8947 | 69 | tempitem.wpn6 = 0; | |
| 8948 | 69 | tempitem.wpn7 = 0; | |
| 8949 | 69 | tempitem.wpn8 = 0; | |
| 8950 | 69 | tempitem.wpn9 = 0; | |
| 8951 | 69 | tempitem.wpn10 = 0; | |
| 8952 | 69 | break; | |
| 8953 | } | ||
| 8954 | case itype_quakescroll2: | ||
| 8955 | { | ||
| 8956 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8957 | 69 | tempitem.misc3 = 0; | |
| 8958 | 69 | tempitem.misc4 = 0; | |
| 8959 | 69 | tempitem.misc5 = 0; | |
| 8960 | 69 | tempitem.misc6 = 0; | |
| 8961 | 69 | tempitem.misc7 = 0; | |
| 8962 | 69 | tempitem.misc8 = 0; | |
| 8963 | 69 | tempitem.misc9 = 0; | |
| 8964 | 69 | tempitem.misc10 = 0; | |
| 8965 | 69 | tempitem.wpn = 0; | |
| 8966 | 69 | tempitem.wpn2 = 0; | |
| 8967 | 69 | tempitem.wpn3 = 0; | |
| 8968 | 69 | tempitem.wpn4 = 0; | |
| 8969 | 69 | tempitem.wpn5 = 0; | |
| 8970 | 69 | tempitem.wpn6 = 0; | |
| 8971 | 69 | tempitem.wpn7 = 0; | |
| 8972 | 69 | tempitem.wpn8 = 0; | |
| 8973 | 69 | tempitem.wpn9 = 0; | |
| 8974 | 69 | tempitem.wpn10 = 0; | |
| 8975 | 69 | break; | |
| 8976 | } | ||
| 8977 | case itype_agony: | ||
| 8978 | { | ||
| 8979 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 8980 | 69 | tempitem.misc2 = 0; | |
| 8981 | 69 | tempitem.misc3 = 0; | |
| 8982 | 69 | tempitem.misc4 = 0; | |
| 8983 | 69 | tempitem.misc5 = 0; | |
| 8984 | 69 | tempitem.misc6 = 0; | |
| 8985 | 69 | tempitem.misc7 = 0; | |
| 8986 | 69 | tempitem.misc8 = 0; | |
| 8987 | 69 | tempitem.misc9 = 0; | |
| 8988 | 69 | tempitem.misc10 = 0; | |
| 8989 | 69 | tempitem.wpn = 0; | |
| 8990 | 69 | tempitem.wpn2 = 0; | |
| 8991 | 69 | tempitem.wpn3 = 0; | |
| 8992 | 69 | tempitem.wpn4 = 0; | |
| 8993 | 69 | tempitem.wpn5 = 0; | |
| 8994 | 69 | tempitem.wpn6 = 0; | |
| 8995 | 69 | tempitem.wpn7 = 0; | |
| 8996 | 69 | tempitem.wpn8 = 0; | |
| 8997 | 69 | tempitem.wpn9 = 0; | |
| 8998 | 69 | tempitem.wpn10 = 0; | |
| 8999 | 69 | break; | |
| 9000 | } | ||
| 9001 | case itype_stompboots: | ||
| 9002 | { | ||
| 9003 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 9004 | 69 | tempitem.misc1 = 0; | |
| 9005 | 69 | tempitem.misc2 = 0; | |
| 9006 | 69 | tempitem.misc3 = 0; | |
| 9007 | 69 | tempitem.misc4 = 0; | |
| 9008 | 69 | tempitem.misc5 = 0; | |
| 9009 | 69 | tempitem.misc6 = 0; | |
| 9010 | 69 | tempitem.misc7 = 0; | |
| 9011 | 69 | tempitem.misc8 = 0; | |
| 9012 | 69 | tempitem.misc9 = 0; | |
| 9013 | 69 | tempitem.misc10 = 0; | |
| 9014 | 69 | tempitem.wpn = 0; | |
| 9015 | 69 | tempitem.wpn2 = 0; | |
| 9016 | 69 | tempitem.wpn3 = 0; | |
| 9017 | 69 | tempitem.wpn4 = 0; | |
| 9018 | 69 | tempitem.wpn5 = 0; | |
| 9019 | 69 | tempitem.wpn6 = 0; | |
| 9020 | 69 | tempitem.wpn7 = 0; | |
| 9021 | 69 | tempitem.wpn8 = 0; | |
| 9022 | 69 | tempitem.wpn9 = 0; | |
| 9023 | 69 | tempitem.wpn10 = 0; | |
| 9024 | 69 | break; | |
| 9025 | } | ||
| 9026 | case itype_whimsicalring: | ||
| 9027 | { | ||
| 9028 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 9029 | 69 | tempitem.misc2 = 0; | |
| 9030 | 69 | tempitem.misc3 = 0; | |
| 9031 | 69 | tempitem.misc4 = 0; | |
| 9032 | 69 | tempitem.misc5 = 0; | |
| 9033 | 69 | tempitem.misc6 = 0; | |
| 9034 | 69 | tempitem.misc7 = 0; | |
| 9035 | 69 | tempitem.misc8 = 0; | |
| 9036 | 69 | tempitem.misc9 = 0; | |
| 9037 | 69 | tempitem.misc10 = 0; | |
| 9038 | 69 | tempitem.wpn = 0; | |
| 9039 | 69 | tempitem.wpn2 = 0; | |
| 9040 | 69 | tempitem.wpn3 = 0; | |
| 9041 | 69 | tempitem.wpn4 = 0; | |
| 9042 | 69 | tempitem.wpn5 = 0; | |
| 9043 | 69 | tempitem.wpn6 = 0; | |
| 9044 | 69 | tempitem.wpn7 = 0; | |
| 9045 | 69 | tempitem.wpn8 = 0; | |
| 9046 | 69 | tempitem.wpn9 = 0; | |
| 9047 | 69 | tempitem.wpn10 = 0; | |
| 9048 | 69 | break; | |
| 9049 | } | ||
| 9050 | case itype_perilring: | ||
| 9051 | { | ||
| 9052 | 69 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 9053 | 69 | tempitem.misc2 = 0; | |
| 9054 | 69 | tempitem.misc3 = 0; | |
| 9055 | 69 | tempitem.misc4 = 0; | |
| 9056 | 69 | tempitem.misc5 = 0; | |
| 9057 | 69 | tempitem.misc6 = 0; | |
| 9058 | 69 | tempitem.misc7 = 0; | |
| 9059 | 69 | tempitem.misc8 = 0; | |
| 9060 | 69 | tempitem.misc9 = 0; | |
| 9061 | 69 | tempitem.misc10 = 0; | |
| 9062 | 69 | tempitem.wpn = 0; | |
| 9063 | 69 | tempitem.wpn2 = 0; | |
| 9064 | 69 | tempitem.wpn3 = 0; | |
| 9065 | 69 | tempitem.wpn4 = 0; | |
| 9066 | 69 | tempitem.wpn5 = 0; | |
| 9067 | 69 | tempitem.wpn6 = 0; | |
| 9068 | 69 | tempitem.wpn7 = 0; | |
| 9069 | 69 | tempitem.wpn8 = 0; | |
| 9070 | 69 | tempitem.wpn9 = 0; | |
| 9071 | 69 | tempitem.wpn10 = 0; | |
| 9072 | 69 | break; | |
| 9073 | } | ||
| 9074 | case itype_custom1: case itype_custom2: case itype_custom3: case itype_custom4: case itype_custom5: | ||
| 9075 | case itype_custom6: case itype_custom7: case itype_custom8: case itype_custom9: case itype_custom10: | ||
| 9076 | case itype_custom11: case itype_custom12: case itype_custom13: case itype_custom14: case itype_custom15: | ||
| 9077 | case itype_custom16: case itype_custom17: case itype_custom18: case itype_custom19: case itype_custom20: | ||
| 9078 | case itype_bowandarrow: case itype_letterpotion: case itype_misc: | ||
| 9079 | { | ||
| 9080 | 1409 | tempitem.flags &= ~ (ITEM_FLAG1 | ITEM_FLAG2 | ITEM_FLAG3 | ITEM_FLAG4 | ITEM_FLAG5); | |
| 9081 | 1409 | tempitem.misc1 = 0; | |
| 9082 | 1409 | tempitem.misc2 = 0; | |
| 9083 | 1409 | tempitem.misc3 = 0; | |
| 9084 | 1409 | tempitem.misc4 = 0; | |
| 9085 | 1409 | tempitem.misc5 = 0; | |
| 9086 | 1409 | tempitem.misc6 = 0; | |
| 9087 | 1409 | tempitem.misc7 = 0; | |
| 9088 | 1409 | tempitem.misc8 = 0; | |
| 9089 | 1409 | tempitem.misc9 = 0; | |
| 9090 | 1409 | tempitem.misc10 = 0; | |
| 9091 | 1409 | tempitem.wpn = 0; | |
| 9092 | 1409 | tempitem.wpn2 = 0; | |
| 9093 | 1409 | tempitem.wpn3 = 0; | |
| 9094 | 1409 | tempitem.wpn4 = 0; | |
| 9095 | 1409 | tempitem.wpn5 = 0; | |
| 9096 | 1409 | tempitem.wpn6 = 0; | |
| 9097 | 1409 | tempitem.wpn7 = 0; | |
| 9098 | 1409 | tempitem.wpn8 = 0; | |
| 9099 | 1409 | tempitem.wpn9 = 0; | |
| 9100 | 1409 | tempitem.wpn10 = 0; | |
| 9101 | 1409 | break; | |
| 9102 | } | ||
| 9103 | } | ||
| 9104 | 17664 | } | |
| 9105 | //Port quest rules to items | ||
| 9106 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if( s_version <= 31) |
| 9107 | { | ||
| 9108 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 17580 times.
|
17664 | if(tempitem.family == itype_bomb) |
| 9109 | { | ||
| 9110 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
|
84 | if ( get_bit(quest_rules,qr_OUCHBOMBS) ) tempitem.flags |= ITEM_FLAG2; |
| 9111 | 84 | else tempitem.flags &= ~ ITEM_FLAG2; | |
| 9112 | 84 | } | |
| 9113 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 17511 times.
|
17580 | else if(tempitem.family == itype_sbomb) |
| 9114 | { | ||
| 9115 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if ( get_bit(quest_rules,qr_OUCHBOMBS) ) tempitem.flags |= ITEM_FLAG2; |
| 9116 | 69 | else tempitem.flags &= ~ ITEM_FLAG2; | |
| 9117 | 69 | } | |
| 9118 | |||
| 9119 |
2/2✓ Branch 0 taken 207 times.
✓ Branch 1 taken 17304 times.
|
17511 | else if(tempitem.family == itype_brang) |
| 9120 | { | ||
| 9121 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 207 times.
|
207 | if ( get_bit(quest_rules,qr_BRANGPICKUP) ) tempitem.flags |= ITEM_FLAG4; |
| 9122 | 207 | else tempitem.flags &= ~ ITEM_FLAG4; | |
| 9123 | 207 | } | |
| 9124 |
2/2✓ Branch 0 taken 17220 times.
✓ Branch 1 taken 84 times.
|
17304 | else if(tempitem.family == itype_wand) |
| 9125 | { | ||
| 9126 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
|
84 | if ( get_bit(quest_rules,qr_NOWANDMELEE) ) tempitem.flags |= ITEM_FLAG3; |
| 9127 | 84 | else tempitem.flags &= ~ ITEM_FLAG3; | |
| 9128 | 84 | } | |
| 9129 | 17664 | } | |
| 9130 | |||
| 9131 | //Port quest rules to items | ||
| 9132 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if( s_version <= 37) |
| 9133 | { | ||
| 9134 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 17595 times.
|
17664 | if(tempitem.family == itype_flippers) |
| 9135 | { | ||
| 9136 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if ( (get_bit(quest_rules,qr_NODIVING)) ) tempitem.flags |= ITEM_FLAG1; |
| 9137 | 69 | else tempitem.flags &= ~ ITEM_FLAG1; | |
| 9138 | 69 | } | |
| 9139 |
2/2✓ Branch 0 taken 11650 times.
✓ Branch 1 taken 5945 times.
|
17595 | else if(tempitem.family == itype_sword) |
| 9140 | { | ||
| 9141 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5945 times.
|
5945 | if ( (get_bit(quest_rules,qr_QUICKSWORD)) ) tempitem.flags |= ITEM_FLAG5; |
| 9142 | 5945 | else tempitem.flags &= ~ ITEM_FLAG5; | |
| 9143 | 5945 | } | |
| 9144 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 11566 times.
|
11650 | else if(tempitem.family == itype_wand) |
| 9145 | { | ||
| 9146 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
|
84 | if ( (get_bit(quest_rules,qr_QUICKSWORD)) ) tempitem.flags |= ITEM_FLAG5; |
| 9147 | 84 | else tempitem.flags &= ~ ITEM_FLAG5; | |
| 9148 | 84 | } | |
| 9149 |
4/4✓ Branch 0 taken 11482 times.
✓ Branch 1 taken 84 times.
✓ Branch 2 taken 176 times.
✓ Branch 3 taken 11306 times.
|
11566 | else if(tempitem.family == itype_book || tempitem.family == itype_candle) |
| 9150 | { | ||
| 9151 | //@Emily: What was qrFIREPROOFHERO2 again, and does that also need to enable this? | ||
| 9152 |
2/2✓ Branch 0 taken 54 times.
✓ Branch 1 taken 206 times.
|
260 | if ( (get_bit(quest_rules,qr_FIREPROOFHERO)) ) tempitem.flags |= ITEM_FLAG3; |
| 9153 | 206 | else tempitem.flags &= ~ ITEM_FLAG3; | |
| 9154 | 260 | } | |
| 9155 | 17664 | } | |
| 9156 | |||
| 9157 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if( s_version < 38) |
| 9158 | { | ||
| 9159 |
4/4✓ Branch 0 taken 17457 times.
✓ Branch 1 taken 207 times.
✓ Branch 2 taken 138 times.
✓ Branch 3 taken 17319 times.
|
17664 | if(tempitem.family == itype_brang || tempitem.family == itype_hookshot) |
| 9160 | { | ||
| 9161 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 345 times.
|
345 | if(get_bit(quest_rules,qr_BRANGPICKUP)) tempitem.flags |= ITEM_FLAG4; |
| 9162 | 345 | else tempitem.flags &= ~ITEM_FLAG4; | |
| 9163 | |||
| 9164 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 345 times.
|
345 | if(get_bit(quest_rules,qr_Z3BRANG_HSHOT)) tempitem.flags |= ITEM_FLAG5 | ITEM_FLAG6; |
| 9165 | 345 | else tempitem.flags &= ~(ITEM_FLAG5|ITEM_FLAG6); | |
| 9166 | 345 | } | |
| 9167 |
2/2✓ Branch 0 taken 17112 times.
✓ Branch 1 taken 207 times.
|
17319 | else if(tempitem.family == itype_arrow) |
| 9168 | { | ||
| 9169 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 207 times.
|
207 | if(get_bit(quest_rules,qr_BRANGPICKUP)) tempitem.flags |= ITEM_FLAG4; |
| 9170 | 207 | else tempitem.flags &= ~ITEM_FLAG4; | |
| 9171 | |||
| 9172 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 207 times.
|
207 | if(get_bit(quest_rules,qr_Z3BRANG_HSHOT)) tempitem.flags &= ~ITEM_FLAG2; |
| 9173 | 207 | else tempitem.flags |= ITEM_FLAG2; | |
| 9174 | 207 | } | |
| 9175 | 17664 | } | |
| 9176 | |||
| 9177 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if( s_version < 39) |
| 9178 | { | ||
| 9179 |
6/6✓ Branch 0 taken 17595 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 17511 times.
✓ Branch 3 taken 84 times.
✓ Branch 4 taken 176 times.
✓ Branch 5 taken 17335 times.
|
17664 | if(tempitem.family == itype_dinsfire || tempitem.family == itype_book || tempitem.family == itype_candle) |
| 9180 | { | ||
| 9181 |
1/2✓ Branch 0 taken 329 times.
✗ Branch 1 not taken.
|
329 | if(get_bit(quest_rules,qr_TEMPCANDLELIGHT)) tempitem.flags |= ITEM_FLAG5; |
| 9182 | 329 | else tempitem.flags &= ~ITEM_FLAG5; | |
| 9183 | 329 | } | |
| 9184 |
2/2✓ Branch 0 taken 138 times.
✓ Branch 1 taken 17197 times.
|
17335 | else if(tempitem.family == itype_potion) |
| 9185 | { | ||
| 9186 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 138 times.
|
138 | if(get_bit(quest_rules,qr_NONBUBBLEMEDICINE)) |
| 9187 | { | ||
| 9188 | ✗ | tempitem.flags &= ~(ITEM_FLAG3|ITEM_FLAG4); | |
| 9189 | } | ||
| 9190 | else | ||
| 9191 | { | ||
| 9192 | 138 | tempitem.flags |= ITEM_FLAG3; | |
| 9193 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 56 times.
|
138 | if(get_bit(quest_rules,qr_ITEMBUBBLE))tempitem.flags |= ITEM_FLAG4; |
| 9194 | 56 | else tempitem.flags &= ~ITEM_FLAG4; | |
| 9195 | } | ||
| 9196 | 138 | } | |
| 9197 |
2/2✓ Branch 0 taken 17059 times.
✓ Branch 1 taken 138 times.
|
17197 | else if(tempitem.family == itype_triforcepiece) |
| 9198 | { | ||
| 9199 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 138 times.
|
138 | if(get_bit(quest_rules,qr_NONBUBBLETRIFORCE)) |
| 9200 | { | ||
| 9201 | ✗ | tempitem.flags |= ITEM_FLAG3; | |
| 9202 | ✗ | if(get_bit(quest_rules,qr_ITEMBUBBLE))tempitem.flags |= ITEM_FLAG4; | |
| 9203 | ✗ | else tempitem.flags &= ~ITEM_FLAG4; | |
| 9204 | } | ||
| 9205 | else | ||
| 9206 | { | ||
| 9207 | 138 | tempitem.flags &= ~(ITEM_FLAG3|ITEM_FLAG4); | |
| 9208 | } | ||
| 9209 | 138 | } | |
| 9210 | 17664 | } | |
| 9211 | |||
| 9212 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if( s_version < 40) |
| 9213 | { | ||
| 9214 |
4/4✓ Branch 0 taken 17457 times.
✓ Branch 1 taken 207 times.
✓ Branch 2 taken 69 times.
✓ Branch 3 taken 17388 times.
|
17664 | if(tempitem.family == itype_ring || tempitem.family == itype_perilring) |
| 9215 | { | ||
| 9216 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(get_bit(quest_rules,qr_RINGAFFECTDAMAGE))tempitem.flags |= ITEM_FLAG1; |
| 9217 | 276 | else tempitem.flags &= ~ITEM_FLAG1; | |
| 9218 | 276 | } | |
| 9219 |
8/8✓ Branch 0 taken 17212 times.
✓ Branch 1 taken 176 times.
✓ Branch 2 taken 11267 times.
✓ Branch 3 taken 5945 times.
✓ Branch 4 taken 11183 times.
✓ Branch 5 taken 84 times.
✓ Branch 6 taken 69 times.
✓ Branch 7 taken 11114 times.
|
17388 | else if(tempitem.family == itype_candle || tempitem.family == itype_sword || tempitem.family == itype_wand || tempitem.family == itype_cbyrna) |
| 9220 | { | ||
| 9221 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6274 times.
|
6274 | if(get_bit(quest_rules,qr_SLASHFLIPFIX))tempitem.flags |= ITEM_FLAG8; |
| 9222 | 6274 | else tempitem.flags &= ~ITEM_FLAG8; | |
| 9223 | 6274 | } | |
| 9224 |
6/6✓ Branch 0 taken 11719 times.
✓ Branch 1 taken 5945 times.
✓ Branch 2 taken 11635 times.
✓ Branch 3 taken 84 times.
✓ Branch 4 taken 69 times.
✓ Branch 5 taken 11566 times.
|
17664 | if(tempitem.family == itype_sword || tempitem.family == itype_wand || tempitem.family == itype_hammer) |
| 9225 | { | ||
| 9226 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6098 times.
|
6098 | if(get_bit(quest_rules,qr_NOITEMMELEE))tempitem.flags |= ITEM_FLAG7; |
| 9227 | 6098 | else tempitem.flags &= ~ITEM_FLAG7; | |
| 9228 | 6098 | } | |
| 9229 |
2/2✓ Branch 0 taken 11497 times.
✓ Branch 1 taken 69 times.
|
11566 | else if(tempitem.family == itype_cbyrna) |
| 9230 | { | ||
| 9231 | 69 | tempitem.flags |= ITEM_FLAG7; | |
| 9232 | 69 | } | |
| 9233 | 17664 | } | |
| 9234 | |||
| 9235 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if( s_version < 41 ) |
| 9236 | { | ||
| 9237 |
2/2✓ Branch 0 taken 11719 times.
✓ Branch 1 taken 5945 times.
|
17664 | if(tempitem.family == itype_sword) |
| 9238 | { | ||
| 9239 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5945 times.
|
5945 | if(get_bit(quest_rules,qr_SWORDMIRROR))tempitem.flags |= ITEM_FLAG9; |
| 9240 | 5945 | else tempitem.flags &= ~ITEM_FLAG9; | |
| 9241 | |||
| 9242 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5945 times.
|
5945 | if(get_bit(quest_rules,qr_SLOWCHARGINGWALK))tempitem.flags |= ITEM_FLAG10; |
| 9243 | 5945 | else tempitem.flags &= ~ITEM_FLAG10; | |
| 9244 | 5945 | } | |
| 9245 | 17664 | } | |
| 9246 | |||
| 9247 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if( s_version < 42 ) |
| 9248 | { | ||
| 9249 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 17580 times.
|
17664 | if(tempitem.family == itype_wand) |
| 9250 | { | ||
| 9251 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
|
84 | if(get_bit(quest_rules,qr_NOWANDMELEE))tempitem.flags |= ITEM_FLAG3; |
| 9252 | 84 | else tempitem.flags &= ~ITEM_FLAG3; | |
| 9253 | |||
| 9254 | 84 | tempitem.flags &= ~ITEM_FLAG6; | |
| 9255 | 84 | } | |
| 9256 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 17511 times.
|
17580 | else if(tempitem.family == itype_hammer) |
| 9257 | { | ||
| 9258 | 69 | tempitem.flags &= ~ITEM_FLAG3; | |
| 9259 | 69 | } | |
| 9260 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 17442 times.
|
17511 | else if(tempitem.family == itype_cbyrna) |
| 9261 | { | ||
| 9262 | 69 | tempitem.flags |= ITEM_FLAG3; | |
| 9263 | |||
| 9264 | 69 | tempitem.flags &= ~ITEM_FLAG6; | |
| 9265 | 69 | } | |
| 9266 |
2/2✓ Branch 0 taken 11497 times.
✓ Branch 1 taken 5945 times.
|
17442 | else if(tempitem.family == itype_sword) |
| 9267 | { | ||
| 9268 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5945 times.
|
5945 | if(get_bit(quest_rules,qr_MELEEMAGICCOST))tempitem.flags |= ITEM_FLAG6; |
| 9269 | 5945 | else tempitem.flags &= ~ITEM_FLAG6; | |
| 9270 | 5945 | } | |
| 9271 | 17664 | } | |
| 9272 | |||
| 9273 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if( s_version < 43 ) |
| 9274 | { | ||
| 9275 |
2/2✓ Branch 0 taken 17549 times.
✓ Branch 1 taken 115 times.
|
17664 | if(tempitem.family == itype_whistle) |
| 9276 | { | ||
| 9277 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 115 times.
|
115 | if(get_bit(quest_rules,qr_WHIRLWINDMIRROR))tempitem.flags |= ITEM_FLAG3; |
| 9278 | 115 | else tempitem.flags &= ~ITEM_FLAG3; | |
| 9279 | 115 | } | |
| 9280 | 17664 | } | |
| 9281 | |||
| 9282 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if( s_version < 45 ) |
| 9283 | { | ||
| 9284 |
2/2✓ Branch 0 taken 17595 times.
✓ Branch 1 taken 69 times.
|
17664 | if(tempitem.family == itype_flippers) |
| 9285 | { | ||
| 9286 | 69 | tempitem.misc1 = 50; //Dive length, default 50 frames -V | |
| 9287 | 69 | tempitem.misc2 = 30; //Dive cooldown, default 30 frames -V | |
| 9288 | 69 | } | |
| 9289 | 17664 | } | |
| 9290 | |||
| 9291 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if( s_version < 46 ) |
| 9292 | { | ||
| 9293 |
2/2✓ Branch 0 taken 17595 times.
✓ Branch 1 taken 69 times.
|
17664 | if(tempitem.family == itype_raft) |
| 9294 | { | ||
| 9295 | 69 | tempitem.misc1 = 1; //Rafting speed modifier; default 1. Negative slows, positive speeds. | |
| 9296 | 69 | } | |
| 9297 | 17664 | } | |
| 9298 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if ( s_version < 34 ) //! set the default counter for older quests. |
| 9299 | { | ||
| 9300 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 17595 times.
|
17664 | if ( (tempitem.flags & ITEM_RUPEE_MAGIC) ) |
| 9301 | { | ||
| 9302 | 69 | tempitem.cost_counter[0] = 1; | |
| 9303 | 69 | } | |
| 9304 | else | ||
| 9305 | { | ||
| 9306 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17595 times.
|
17595 | if(get_bit(quest_rules,qr_ENABLEMAGIC)) |
| 9307 | ✗ | tempitem.cost_counter[0] = 4; | |
| 9308 | else | ||
| 9309 | { | ||
| 9310 | 17595 | tempitem.cost_amount[0] = 0; | |
| 9311 | 17595 | tempitem.cost_counter[0] = -1; | |
| 9312 | } | ||
| 9313 | } | ||
| 9314 | 17664 | } | |
| 9315 | |||
| 9316 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if ( s_version < 35 ) //new Lens of Truth flags |
| 9317 | { | ||
| 9318 |
2/2✓ Branch 0 taken 17595 times.
✓ Branch 1 taken 69 times.
|
17664 | if ( tempitem.family == itype_lens ) |
| 9319 | { | ||
| 9320 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if ( get_bit(quest_rules,qr_RAFTLENS) ) |
| 9321 | { | ||
| 9322 | ✗ | tempitem.flags |= ITEM_FLAG4; | |
| 9323 | } | ||
| 9324 |
2/2✓ Branch 0 taken 33 times.
✓ Branch 1 taken 36 times.
|
69 | if ( get_bit(quest_rules,qr_LENSHINTS) ) |
| 9325 | { | ||
| 9326 | 33 | tempitem.flags |= ITEM_FLAG1; | |
| 9327 | 33 | } | |
| 9328 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if ( get_bit(quest_rules,qr_LENSSEESENEMIES) ) |
| 9329 | { | ||
| 9330 | ✗ | tempitem.flags |= ITEM_FLAG5; | |
| 9331 | } | ||
| 9332 | 69 | } | |
| 9333 | 17664 | } | |
| 9334 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if ( s_version < 44 ) //InitD Labels and Sprite Script Data |
| 9335 | { | ||
| 9336 |
2/2✓ Branch 0 taken 141312 times.
✓ Branch 1 taken 17664 times.
|
158976 | for ( int32_t q = 0; q < 8; q++ ) |
| 9337 | { | ||
| 9338 | 141312 | sprintf(tempitem.initD_label[q],"InitD[%d]",q); | |
| 9339 | 141312 | sprintf(tempitem.weapon_initD_label[q],"InitD[%d]",q); | |
| 9340 | 141312 | sprintf(tempitem.sprite_initD_label[q],"InitD[%d]",q); | |
| 9341 | 141312 | tempitem.sprite_initiald[q] = 0; | |
| 9342 | 141312 | } | |
| 9343 |
2/2✓ Branch 0 taken 35328 times.
✓ Branch 1 taken 17664 times.
|
52992 | for ( int32_t q = 0; q < 2; q++ ) tempitem.sprite_initiala[q] = 0; |
| 9344 | 17664 | tempitem.sprite_script = 0; | |
| 9345 | 17664 | } | |
| 9346 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if ( s_version < 47 ) //InitD Labels and Sprite Script Data |
| 9347 | { | ||
| 9348 | 17664 | tempitem.pickupflag = 0; | |
| 9349 | 17664 | } | |
| 9350 | |||
| 9351 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if( s_version < 51 ) |
| 9352 | { | ||
| 9353 |
2/2✓ Branch 0 taken 17488 times.
✓ Branch 1 taken 176 times.
|
17664 | if( tempitem.family == itype_candle ) |
| 9354 | { | ||
| 9355 | 176 | tempitem.misc4 = 50; //Step speed | |
| 9356 | 176 | } | |
| 9357 | 17664 | } | |
| 9358 | |||
| 9359 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if( s_version < 52 ) |
| 9360 | { | ||
| 9361 |
2/2✓ Branch 0 taken 17457 times.
✓ Branch 1 taken 207 times.
|
17664 | if( tempitem.family == itype_shield ) |
| 9362 | 207 | tempitem.flags |= ITEM_FLAG1; //'Block Front' flag | |
| 9363 | 17664 | } | |
| 9364 | |||
| 9365 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
|
19712 | if(tempitem.fam_type==0) // Always do this |
| 9366 | ✗ | tempitem.fam_type=1; | |
| 9367 | |||
| 9368 | 19712 | memcpy(&itemsbuf[i], &tempitem, sizeof(itemdata)); | |
| 9369 | 19712 | } | |
| 9370 | 77 | } | |
| 9371 | |||
| 9372 | 77 | return 0; | |
| 9373 | 77 | } | |
| 9374 | |||
| 9375 | static bool did_init_def_items = false; | ||
| 9376 | 39424 | void init_def_items() | |
| 9377 | { | ||
| 9378 |
2/2✓ Branch 0 taken 39410 times.
✓ Branch 1 taken 14 times.
|
39424 | if(did_init_def_items) return; |
| 9379 | 14 | did_init_def_items = true; | |
| 9380 | 14 | default_items[3].cost_counter[1] = crBOMBS; | |
| 9381 | 14 | default_items[13].cost_counter[1] = crARROWS; | |
| 9382 | 14 | default_items[14].cost_counter[1] = crARROWS; | |
| 9383 | 14 | default_items[48].cost_counter[1] = crBOMBS; | |
| 9384 | 14 | default_items[57].cost_counter[1] = crARROWS; | |
| 9385 | 39424 | } | |
| 9386 | 39424 | void reset_itembuf(itemdata *item, int32_t id) | |
| 9387 | { | ||
| 9388 | 39424 | init_def_items(); | |
| 9389 |
2/2✓ Branch 0 taken 17402 times.
✓ Branch 1 taken 22022 times.
|
39424 | if(id<iLast) |
| 9390 | { | ||
| 9391 | // Copy everything *EXCEPT* the tile, misc, cset, frames, speed, delay and ltm. | ||
| 9392 | 22022 | word tile = item->tile; | |
| 9393 | 22022 | byte miscs = item->misc_flags, cset = item->csets, frames = item->frames, speed = item->speed, delay = item->delay; | |
| 9394 | 22022 | int32_t ltm = item->ltm; | |
| 9395 | |||
| 9396 | 22022 | memcpy(item,&default_items[id],sizeof(itemdata)); | |
| 9397 | 22022 | item->tile = tile; | |
| 9398 | 22022 | item->misc_flags = miscs; | |
| 9399 | 22022 | item->csets = cset; | |
| 9400 | 22022 | item->frames = frames; | |
| 9401 | 22022 | item->speed = speed; | |
| 9402 | 22022 | item->delay = delay; | |
| 9403 | 22022 | item->ltm = ltm; | |
| 9404 | 22022 | } | |
| 9405 | 39424 | } | |
| 9406 | |||
| 9407 | 3584 | void reset_itemname(int32_t id) | |
| 9408 | { | ||
| 9409 | 3584 | sprintf(item_string[id],"zz%03d",id); | |
| 9410 | |||
| 9411 |
2/2✓ Branch 0 taken 1582 times.
✓ Branch 1 taken 2002 times.
|
3584 | if(id < iLast) |
| 9412 | 2002 | strcpy(item_string[id],old_item_string[id]); | |
| 9413 | 3584 | } | |
| 9414 | |||
| 9415 | 77 | int32_t readweapons(PACKFILE *f, zquestheader *Header, bool keepdata) | |
| 9416 | { | ||
| 9417 | 77 | word weapons_to_read=MAXWPNS; | |
| 9418 | int32_t dummy; | ||
| 9419 | byte padding; | ||
| 9420 | wpndata tempweapon; | ||
| 9421 | 77 | word s_version=0, s_cversion=0; | |
| 9422 | |||
| 9423 | |||
| 9424 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(Header->zelda_version < 0x186) |
| 9425 | { | ||
| 9426 | ✗ | weapons_to_read=64; | |
| 9427 | } | ||
| 9428 | |||
| 9429 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(Header->zelda_version < 0x185) |
| 9430 | { | ||
| 9431 | ✗ | weapons_to_read=32; | |
| 9432 | } | ||
| 9433 | |||
| 9434 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(Header->zelda_version > 0x192) |
| 9435 | { | ||
| 9436 | 77 | weapons_to_read=0; | |
| 9437 | |||
| 9438 | //section version info | ||
| 9439 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_version,f,true)) |
| 9440 | { | ||
| 9441 | ✗ | return qe_invalid; | |
| 9442 | } | ||
| 9443 | |||
| 9444 | 77 | FFCore.quest_format[vWeaponSprites] = s_version; | |
| 9445 | |||
| 9446 | //al_trace("Weapons version %d\n", s_version); | ||
| 9447 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_cversion,f,true)) |
| 9448 | { | ||
| 9449 | ✗ | return qe_invalid; | |
| 9450 | } | ||
| 9451 | |||
| 9452 | //section size | ||
| 9453 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&dummy,f,true)) |
| 9454 | { | ||
| 9455 | ✗ | return qe_invalid; | |
| 9456 | } | ||
| 9457 | |||
| 9458 | //finally... section data | ||
| 9459 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&weapons_to_read,f,true)) |
| 9460 | { | ||
| 9461 | ✗ | return qe_invalid; | |
| 9462 | } | ||
| 9463 | 77 | } | |
| 9464 | |||
| 9465 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version>2) |
| 9466 | { | ||
| 9467 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<weapons_to_read; i++) |
| 9468 | { | ||
| 9469 | char tempname[64]; | ||
| 9470 | |||
| 9471 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!pfread(tempname, 64, f, keepdata)) |
| 9472 | { | ||
| 9473 | ✗ | return qe_invalid; | |
| 9474 | } | ||
| 9475 | |||
| 9476 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
|
19712 | if(keepdata) |
| 9477 | { | ||
| 9478 | 19712 | strcpy(weapon_string[i], tempname); | |
| 9479 | 19712 | } | |
| 9480 | 19712 | } | |
| 9481 | |||
| 9482 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version<4) |
| 9483 | { | ||
| 9484 | ✗ | if(keepdata) | |
| 9485 | { | ||
| 9486 | ✗ | strcpy(weapon_string[iwHover],old_weapon_string[iwHover]); | |
| 9487 | ✗ | strcpy(weapon_string[wFIREMAGIC],old_weapon_string[wFIREMAGIC]); | |
| 9488 | } | ||
| 9489 | } | ||
| 9490 | |||
| 9491 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version<5) |
| 9492 | { | ||
| 9493 | ✗ | if(keepdata) | |
| 9494 | { | ||
| 9495 | ✗ | strcpy(weapon_string[iwQuarterHearts],old_weapon_string[iwQuarterHearts]); | |
| 9496 | } | ||
| 9497 | } | ||
| 9498 | |||
| 9499 | /* | ||
| 9500 | if (s_version<6) | ||
| 9501 | { | ||
| 9502 | strcpy(weapon_string[iwSideRaft],old_weapon_string[iwSideRaft]); | ||
| 9503 | strcpy(weapon_string[iwSideLadder],old_weapon_string[iwSideLadder]); | ||
| 9504 | } | ||
| 9505 | */ | ||
| 9506 | 77 | } | |
| 9507 | else | ||
| 9508 | { | ||
| 9509 | ✗ | if(keepdata) | |
| 9510 | ✗ | for(int32_t i=0; i<WPNCNT; i++) | |
| 9511 | ✗ | reset_weaponname(i); | |
| 9512 | } | ||
| 9513 | |||
| 9514 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<weapons_to_read; i++) |
| 9515 | { | ||
| 9516 | 19712 | word oldtile = 0; | |
| 9517 |
2/2✓ Branch 0 taken 1024 times.
✓ Branch 1 taken 18688 times.
|
19712 | if (s_version < 8) |
| 9518 | { | ||
| 9519 |
1/2✓ Branch 0 taken 18688 times.
✗ Branch 1 not taken.
|
18688 | if (!p_igetw(&oldtile, f, true)) |
| 9520 | ✗ | return qe_invalid; | |
| 9521 | 18688 | } | |
| 9522 | |||
| 9523 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempweapon.misc,f,true)) |
| 9524 | { | ||
| 9525 | ✗ | return qe_invalid; | |
| 9526 | } | ||
| 9527 | |||
| 9528 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempweapon.csets,f,true)) |
| 9529 | { | ||
| 9530 | ✗ | return qe_invalid; | |
| 9531 | } | ||
| 9532 | |||
| 9533 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempweapon.frames,f,true)) |
| 9534 | { | ||
| 9535 | ✗ | return qe_invalid; | |
| 9536 | } | ||
| 9537 | |||
| 9538 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempweapon.speed,f,true)) |
| 9539 | { | ||
| 9540 | ✗ | return qe_invalid; | |
| 9541 | } | ||
| 9542 | |||
| 9543 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(!p_getc(&tempweapon.type,f,true)) |
| 9544 | { | ||
| 9545 | ✗ | return qe_invalid; | |
| 9546 | } | ||
| 9547 | |||
| 9548 |
2/2✓ Branch 0 taken 17664 times.
✓ Branch 1 taken 2048 times.
|
19712 | if ( s_version >= 7 ) |
| 9549 | { | ||
| 9550 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetw(&tempweapon.script,f,true)) |
| 9551 | { | ||
| 9552 | ✗ | return qe_invalid; | |
| 9553 | } | ||
| 9554 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_igetl(&tempweapon.tile,f,true)) |
| 9555 | { | ||
| 9556 | ✗ | return qe_invalid; | |
| 9557 | } | ||
| 9558 | 2048 | } | |
| 9559 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 17664 times.
|
19712 | if ( s_version < 7 ) |
| 9560 | { | ||
| 9561 | 17664 | tempweapon.tile = oldtile; | |
| 9562 | 17664 | } | |
| 9563 | |||
| 9564 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(Header->zelda_version < 0x193) |
| 9565 | { | ||
| 9566 | ✗ | if(!p_getc(&padding,f,true)) | |
| 9567 | { | ||
| 9568 | ✗ | return qe_invalid; | |
| 9569 | } | ||
| 9570 | } | ||
| 9571 | |||
| 9572 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(s_version < 6) |
| 9573 | { | ||
| 9574 | ✗ | if(i==ewFIRETRAIL) | |
| 9575 | { | ||
| 9576 | ✗ | tempweapon.misc |= WF_BEHIND; | |
| 9577 | } | ||
| 9578 | else | ||
| 9579 | ✗ | tempweapon.misc &= ~WF_BEHIND; | |
| 9580 | } | ||
| 9581 | |||
| 9582 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
|
19712 | if(keepdata==true) |
| 9583 | { | ||
| 9584 | 19712 | memcpy(&wpnsbuf[i], &tempweapon, sizeof(tempweapon)); | |
| 9585 | 19712 | } | |
| 9586 | 19712 | } | |
| 9587 | |||
| 9588 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata==true) |
| 9589 | { | ||
| 9590 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version<2) |
| 9591 | { | ||
| 9592 | ✗ | wpnsbuf[wSBOOM]=wpnsbuf[wBOOM]; | |
| 9593 | } | ||
| 9594 | |||
| 9595 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version<5) |
| 9596 | { | ||
| 9597 | ✗ | wpnsbuf[iwQuarterHearts].tile=1; | |
| 9598 | ✗ | wpnsbuf[iwQuarterHearts].csets=1; | |
| 9599 | } | ||
| 9600 | |||
| 9601 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(Header->zelda_version < 0x176) |
| 9602 | { | ||
| 9603 | ✗ | wpnsbuf[iwSpawn] = *((wpndata*)(itemsbuf + iMisc1)); | |
| 9604 | ✗ | wpnsbuf[iwDeath] = *((wpndata*)(itemsbuf + iMisc2)); | |
| 9605 | ✗ | memset(&itemsbuf[iMisc1],0,sizeof(itemdata)); | |
| 9606 | ✗ | memset(&itemsbuf[iMisc2],0,sizeof(itemdata)); | |
| 9607 | } | ||
| 9608 | |||
| 9609 |
1/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
77 | if((Header->zelda_version < 0x192)|| |
| 9610 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ((Header->zelda_version == 0x192)&&(Header->build<129))) |
| 9611 | { | ||
| 9612 | ✗ | wpnsbuf[wHSCHAIN_V] = wpnsbuf[wHSCHAIN_H]; | |
| 9613 | } | ||
| 9614 | |||
| 9615 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if((Header->zelda_version < 0x210)) |
| 9616 | { | ||
| 9617 | ✗ | wpnsbuf[wLSHEAD] = wpnsbuf[wHSHEAD]; | |
| 9618 | ✗ | wpnsbuf[wLSCHAIN_H] = wpnsbuf[wHSCHAIN_H]; | |
| 9619 | ✗ | wpnsbuf[wLSHANDLE] = wpnsbuf[wHSHANDLE]; | |
| 9620 | ✗ | wpnsbuf[wLSCHAIN_V] = wpnsbuf[wHSCHAIN_V]; | |
| 9621 | } | ||
| 9622 | 77 | } | |
| 9623 | |||
| 9624 | 77 | return 0; | |
| 9625 | 77 | } | |
| 9626 | |||
| 9627 | 77 | void init_guys(int32_t guyversion) | |
| 9628 | { | ||
| 9629 |
2/2✓ Branch 0 taken 39424 times.
✓ Branch 1 taken 77 times.
|
39501 | for(int32_t i=0; i<MAXGUYS; i++) |
| 9630 | { | ||
| 9631 | 39424 | guysbuf[i] = default_guys[0]; | |
| 9632 | 39424 | } | |
| 9633 | |||
| 9634 |
2/2✓ Branch 0 taken 13629 times.
✓ Branch 1 taken 77 times.
|
13706 | for(int32_t i=0; i<OLDMAXGUYS; i++) |
| 9635 | { | ||
| 9636 | 13629 | guysbuf[i] = default_guys[i]; | |
| 9637 |
2/2✓ Branch 0 taken 13475 times.
✓ Branch 1 taken 154 times.
|
13629 | guysbuf[i].spr_shadow = (guysbuf[i].family==eeROCK && guysbuf[i].misc10==1) ? iwLargeShadow : iwShadow; |
| 9638 | 13629 | guysbuf[i].spr_death = iwDeath; | |
| 9639 | 13629 | guysbuf[i].spr_spawn = iwSpawn; | |
| 9640 | // Patra fix: 2.10 BSPatras used spDIG. 2.50 Patras use CSet 7. | ||
| 9641 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 13629 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
13629 | if(guyversion<=3 && i==ePATRABS) |
| 9642 | { | ||
| 9643 | ✗ | guysbuf[i].bosspal=spDIG; | |
| 9644 | ✗ | guysbuf[i].cset=14; | |
| 9645 | ✗ | guysbuf[i].misc9=14; | |
| 9646 | } | ||
| 9647 | |||
| 9648 |
1/2✓ Branch 0 taken 13629 times.
✗ Branch 1 not taken.
|
13629 | if(guyversion<=3) |
| 9649 | { | ||
| 9650 | // Rope/Ghini Flash rules | ||
| 9651 | ✗ | if(get_bit(deprecated_rules, qr_NOROPE2FLASH_DEP)) | |
| 9652 | { | ||
| 9653 | ✗ | if(i==eROPE2) | |
| 9654 | { | ||
| 9655 | ✗ | guysbuf[i].flags2 &= ~guy_flashing; | |
| 9656 | } | ||
| 9657 | } | ||
| 9658 | |||
| 9659 | ✗ | if(get_bit(deprecated_rules, qr_NOBUBBLEFLASH_DEP)) | |
| 9660 | { | ||
| 9661 | ✗ | if(i==eBUBBLEST || i==eBUBBLESP || i==eBUBBLESR || i==eBUBBLEIT || i==eBUBBLEIP || i==eBUBBLEIR) | |
| 9662 | { | ||
| 9663 | ✗ | guysbuf[i].flags2 &= ~guy_flashing; | |
| 9664 | } | ||
| 9665 | } | ||
| 9666 | |||
| 9667 | ✗ | if(i==eGHINI2) | |
| 9668 | { | ||
| 9669 | ✗ | if(get_bit(deprecated_rules, qr_GHINI2BLINK_DEP)) | |
| 9670 | { | ||
| 9671 | ✗ | guysbuf[i].flags2 |= guy_blinking; | |
| 9672 | } | ||
| 9673 | |||
| 9674 | ✗ | if(get_bit(deprecated_rules, qr_PHANTOMGHINI2_DEP)) | |
| 9675 | { | ||
| 9676 | ✗ | guysbuf[i].flags2 |= guy_transparent; | |
| 9677 | } | ||
| 9678 | } | ||
| 9679 | } | ||
| 9680 | |||
| 9681 | // Darknut fix | ||
| 9682 |
10/10✓ Branch 0 taken 13552 times.
✓ Branch 1 taken 77 times.
✓ Branch 2 taken 13475 times.
✓ Branch 3 taken 77 times.
✓ Branch 4 taken 13398 times.
✓ Branch 5 taken 77 times.
✓ Branch 6 taken 13321 times.
✓ Branch 7 taken 77 times.
✓ Branch 8 taken 77 times.
✓ Branch 9 taken 13244 times.
|
13629 | if(i==eDKNUT1 || i==eDKNUT2 || i==eDKNUT3 || i==eDKNUT4 || i==eDKNUT5) |
| 9683 | { | ||
| 9684 |
2/2✓ Branch 0 taken 205 times.
✓ Branch 1 taken 180 times.
|
385 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 9685 | { | ||
| 9686 | 205 | guysbuf[i].s_tile=guysbuf[i].e_tile+120; | |
| 9687 | 205 | guysbuf[i].s_width=guysbuf[i].e_width; | |
| 9688 | 205 | guysbuf[i].s_height=guysbuf[i].e_height; | |
| 9689 | 205 | } | |
| 9690 | 180 | else guysbuf[i].s_tile=860; | |
| 9691 | |||
| 9692 |
1/2✓ Branch 0 taken 385 times.
✗ Branch 1 not taken.
|
385 | if(get_bit(deprecated_rules,qr_BRKBLSHLDS_DEP)) |
| 9693 | { | ||
| 9694 | ✗ | guysbuf[i].flags |= guy_bkshield; | |
| 9695 | } | ||
| 9696 | 385 | } | |
| 9697 | |||
| 9698 |
3/4✓ Branch 0 taken 13552 times.
✓ Branch 1 taken 77 times.
✓ Branch 2 taken 13629 times.
✗ Branch 3 not taken.
|
13629 | if((i==eGELTRIB || i==eFGELTRIB) && get_bit(deprecated_rules,qr_OLDTRIBBLES_DEP)) |
| 9699 | { | ||
| 9700 | ✗ | guysbuf[i].misc3 = (i==eFGELTRIB ? eFZOL : eZOL); | |
| 9701 | } | ||
| 9702 | 13629 | } | |
| 9703 | 77 | } | |
| 9704 | |||
| 9705 | ✗ | void reset_weaponname(int32_t i) | |
| 9706 | { | ||
| 9707 | ✗ | if(i<wLast) | |
| 9708 | { | ||
| 9709 | ✗ | strcpy(weapon_string[i],old_weapon_string[i]); | |
| 9710 | } | ||
| 9711 | else | ||
| 9712 | ✗ | sprintf(weapon_string[i],"zz%03d",i); | |
| 9713 | } | ||
| 9714 | |||
| 9715 | 77 | void init_item_drop_sets() | |
| 9716 | { | ||
| 9717 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<MAXITEMDROPSETS; i++) |
| 9718 | { | ||
| 9719 | // item_drop_sets[i] = default_item_drop_sets[0]; | ||
| 9720 | 19712 | memset(&item_drop_sets[i], 0, sizeof(item_drop_object)); | |
| 9721 | 19712 | } | |
| 9722 | |||
| 9723 |
2/2✓ Branch 0 taken 1001 times.
✓ Branch 1 taken 77 times.
|
1078 | for(int32_t i=0; i<isMAX; i++) |
| 9724 | { | ||
| 9725 | 1001 | item_drop_sets[i] = default_item_drop_sets[i]; | |
| 9726 | |||
| 9727 | // Deprecated: qr_NOCLOCKS and qr_ALLOW10RUPEEDROPS | ||
| 9728 |
2/2✓ Branch 0 taken 10010 times.
✓ Branch 1 taken 1001 times.
|
11011 | for(int32_t j=0; j<10; ++j) |
| 9729 | { | ||
| 9730 | 10010 | int32_t it = item_drop_sets[i].item[j]; | |
| 9731 | |||
| 9732 |
3/4✓ Branch 0 taken 7084 times.
✓ Branch 1 taken 2926 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 462 times.
|
10010 | if((itemsbuf[it].family == itype_rupee && ((itemsbuf[it].amount)&0xFFF) == 10) |
| 9733 |
2/2✓ Branch 0 taken 462 times.
✓ Branch 1 taken 6622 times.
|
7084 | && !get_bit(deprecated_rules, qr_ALLOW10RUPEEDROPS_DEP)) |
| 9734 | { | ||
| 9735 | 462 | item_drop_sets[i].chance[j+1]=0; | |
| 9736 | 462 | } | |
| 9737 |
3/4✓ Branch 0 taken 308 times.
✓ Branch 1 taken 9240 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 308 times.
|
9548 | else if(itemsbuf[it].family == itype_clock && get_bit(deprecated_rules, qr_NOCLOCKS_DEP)) |
| 9738 | { | ||
| 9739 | ✗ | item_drop_sets[i].chance[j+1]=0; | |
| 9740 | } | ||
| 9741 | |||
| 9742 | // From Sept 2007 to Dec 2008, non-gameplay items were prohibited. | ||
| 9743 |
2/2✓ Branch 0 taken 10002 times.
✓ Branch 1 taken 8 times.
|
10010 | if(itemsbuf[it].family == itype_misc) |
| 9744 | { | ||
| 9745 | // If a non-gameplay item was selected, then item drop was aborted. | ||
| 9746 | // Reflect this by increasing the 'Nothing' chance accordingly. | ||
| 9747 | 8 | item_drop_sets[i].chance[0]+=item_drop_sets[i].chance[j+1]; | |
| 9748 | 8 | item_drop_sets[i].chance[j+1]=0; | |
| 9749 | 8 | } | |
| 9750 | 10010 | } | |
| 9751 | 1001 | } | |
| 9752 | 77 | } | |
| 9753 | |||
| 9754 | 77 | void init_favorites() | |
| 9755 | { | ||
| 9756 |
2/2✓ Branch 0 taken 7700 times.
✓ Branch 1 taken 77 times.
|
7777 | for(int32_t i=0; i<MAXFAVORITECOMBOS; i++) |
| 9757 | { | ||
| 9758 | 7700 | favorite_combos[i]=-1; | |
| 9759 | 7700 | } | |
| 9760 | |||
| 9761 |
2/2✓ Branch 0 taken 7700 times.
✓ Branch 1 taken 77 times.
|
7777 | for(int32_t i=0; i<MAXFAVORITECOMBOALIASES; i++) |
| 9762 | { | ||
| 9763 | 7700 | favorite_comboaliases[i]=-1; | |
| 9764 | 7700 | } | |
| 9765 | 77 | } | |
| 9766 | |||
| 9767 | const char *ctype_name[cMAX]= | ||
| 9768 | { | ||
| 9769 | "cNONE", "cSTAIR", "cCAVE", "cWATER", "cARMOS", "cGRAVE", "cDOCK", | ||
| 9770 | "cUNDEF", "cPUSH_WAIT", "cPUSH_HEAVY", "cPUSH_HW", "cL_STATUE", "cR_STATUE", | ||
| 9771 | "cWALKSLOW", "cCVUP", "cCVDOWN", "cCVLEFT", "cCVRIGHT", "cSWIMWARP", "cDIVEWARP", | ||
| 9772 | "cLADDERHOOKSHOT", "cTRIGNOFLAG", "cTRIGFLAG", "cZELDA", "cSLASH", "cSLASHITEM", | ||
| 9773 | "cPUSH_HEAVY2", "cPUSH_HW2", "cPOUND", "cHSGRAB", "cHSBRIDGE", "cDAMAGE1", | ||
| 9774 | "cDAMAGE2", "cDAMAGE3", "cDAMAGE4", "cC_STATUE", "cTRAP_H", "cTRAP_V", "cTRAP_4", | ||
| 9775 | "cTRAP_LR", "cTRAP_UD", "cPIT", "cHOOKSHOTONLY", "cOVERHEAD", "cNOFLYZONE", "cMIRROR", | ||
| 9776 | "cMIRRORSLASH", "cMIRRORBACKSLASH", "cMAGICPRISM", "cMAGICPRISM4", | ||
| 9777 | "cMAGICSPONGE", "cCAVE2", "cEYEBALL_A", "cEYEBALL_B", "cNOJUMPZONE", "cBUSH", | ||
| 9778 | "cFLOWERS", "cTALLGRASS", "cSHALLOWWATER", "cLOCKBLOCK", "cLOCKBLOCK2", | ||
| 9779 | "cBOSSLOCKBLOCK", "cBOSSLOCKBLOCK2", "cLADDERONLY", "cBSGRAVE", | ||
| 9780 | "cCHEST", "cCHEST2", "cLOCKEDCHEST", "cLOCKEDCHEST2", "cBOSSCHEST", "cBOSSCHEST2", | ||
| 9781 | "cRESET", "cSAVE", "cSAVE2", "cCAVEB", "cCAVEC", "cCAVED", | ||
| 9782 | "cSTAIRB", "cSTAIRC", "cSTAIRD", "cPITB", "cPITC", "cPITD", | ||
| 9783 | "cCAVE2B", "cCAVE2C", "cCAVE2D", "cSWIMWARPB", "cSWIMWARPC", "cSWIMWARPD", | ||
| 9784 | "cDIVEWARPB", "cDIVEWARPC", "cDIVEWARPD", "cSTAIRR", "cPITR", | ||
| 9785 | "cAWARPA", "cAWARPB", "cAWARPC", "cAWARPD", "cAWARPR", | ||
| 9786 | "cSWARPA", "cSWARPB", "cSWARPC", "cSWARPD", "cSWARPR", "cSTRIGNOFLAG", "cSTRIGFLAG", | ||
| 9787 | "cSTEP", "cSTEPSAME", "cSTEPALL", "cSTEPCOPY", "cNOENEMY", "cBLOCKARROW1", "cBLOCKARROW2", | ||
| 9788 | "cBLOCKARROW3", "cBLOCKBRANG1", "cBLOCKBRANG2", "cBLOCKBRANG3", "cBLOCKSBEAM", "cBLOCKALL", | ||
| 9789 | "cBLOCKFIREBALL", "cDAMAGE5", "cDAMAGE6", "cDAMAGE7", "cCHANGE", "cSPINTILE1", "cSPINTILE2", | ||
| 9790 | "cSCREENFREEZE", "cSCREENFREEZEFF", "cNOGROUNDENEMY", "cSLASHNEXT", "cSLASHNEXTITEM", "cBUSHNEXT" | ||
| 9791 | "cSLASHTOUCHY", "cSLASHITEMTOUCHY", "cBUSHTOUCHY", "cFLOWERSTOUCHY", "cTALLGRASSTOUCHY", | ||
| 9792 | "cSLASHNEXTTOUCHY", "cSLASHNEXTITEMTOUCHY", "cBUSHNEXTTOUCHY", "cEYEBALL_4", "cTALLGRASSNEXT", | ||
| 9793 | "cSCRIPT1", "cSCRIPT2", "cSCRIPT3", "cSCRIPT4", "cSCRIPT5", | ||
| 9794 | "cSCRIPT6", "cSCRIPT7", "cSCRIPT8", "cSCRIPT9", "cSCRIPT10", | ||
| 9795 | "cSCRIPT11", "cSCRIPT12", "cSCRIPT13", "cSCRIPT14", "cSCRIPT15", | ||
| 9796 | "cSCRIPT16", "cSCRIPT17", "cSCRIPT18", "cSCRIPT19", "cSCRIPT20" | ||
| 9797 | |||
| 9798 | }; | ||
| 9799 | |||
| 9800 | 147 | int32_t init_combo_classes() | |
| 9801 | { | ||
| 9802 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 147 times.
|
147 | zinfo* zi = (load_tmp_zi ? load_tmp_zi : &ZI); |
| 9803 |
2/2✓ Branch 0 taken 26166 times.
✓ Branch 1 taken 147 times.
|
26313 | for(int32_t i=0; i<cMAX; i++) |
| 9804 | { | ||
| 9805 | 26166 | combo_class_buf[i] = default_combo_classes[i]; | |
| 9806 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26166 times.
|
26166 | if ( char const* nm = zi->getComboTypeName(i) ) |
| 9807 | { | ||
| 9808 | 26166 | size_t len = strlen(nm); | |
| 9809 |
2/2✓ Branch 0 taken 1674624 times.
✓ Branch 1 taken 26166 times.
|
1700790 | for ( size_t q = 0; q < 64; q++ ) |
| 9810 | { | ||
| 9811 |
2/2✓ Branch 0 taken 387786 times.
✓ Branch 1 taken 1286838 times.
|
1674624 | combo_class_buf[i].name[q] = (q<len ? nm[q] : 0); |
| 9812 | 1674624 | } | |
| 9813 | 26166 | } | |
| 9814 | 26166 | } | |
| 9815 | |||
| 9816 | 147 | return 0; | |
| 9817 | } | ||
| 9818 | |||
| 9819 | 69 | int32_t readherosprites2(PACKFILE *f, int32_t v_herosprites, int32_t cv_herosprites, bool keepdata) | |
| 9820 | { | ||
| 9821 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | assert(v_herosprites < 6); |
| 9822 | //these are here to bypass compiler warnings about unused arguments | ||
| 9823 | 69 | cv_herosprites=cv_herosprites; | |
| 9824 | |||
| 9825 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if(keepdata) |
| 9826 | { | ||
| 9827 | 69 | zinit.hero_swim_speed=67; //default | |
| 9828 | 69 | setupherotiles(zinit.heroAnimationStyle); | |
| 9829 | 69 | setupherodefenses(); | |
| 9830 | 69 | setupherooffsets(); | |
| 9831 | 69 | } | |
| 9832 | |||
| 9833 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if(v_herosprites>=0) |
| 9834 | { | ||
| 9835 | word tile, tile2; | ||
| 9836 | byte flip, extend, dummy_byte; | ||
| 9837 | |||
| 9838 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 69 times.
|
345 | for(int32_t i=0; i<4; i++) |
| 9839 | { | ||
| 9840 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_igetw(&tile,f,keepdata)) |
| 9841 | { | ||
| 9842 | ✗ | return qe_invalid; | |
| 9843 | } | ||
| 9844 | |||
| 9845 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&flip,f,keepdata)) |
| 9846 | { | ||
| 9847 | ✗ | return qe_invalid; | |
| 9848 | } | ||
| 9849 | |||
| 9850 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&extend,f,keepdata)) |
| 9851 | { | ||
| 9852 | ✗ | return qe_invalid; | |
| 9853 | } | ||
| 9854 | |||
| 9855 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(keepdata) |
| 9856 | { | ||
| 9857 | 276 | walkspr[i][spr_tile]=(int32_t)tile; | |
| 9858 | 276 | walkspr[i][spr_flip]=(int32_t)flip; | |
| 9859 | 276 | walkspr[i][spr_extend]=(int32_t)extend; | |
| 9860 | 276 | } | |
| 9861 | 276 | } | |
| 9862 | |||
| 9863 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 69 times.
|
345 | for(int32_t i=0; i<4; i++) |
| 9864 | { | ||
| 9865 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_igetw(&tile,f,keepdata)) |
| 9866 | { | ||
| 9867 | ✗ | return qe_invalid; | |
| 9868 | } | ||
| 9869 | |||
| 9870 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&flip,f,keepdata)) |
| 9871 | { | ||
| 9872 | ✗ | return qe_invalid; | |
| 9873 | } | ||
| 9874 | |||
| 9875 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&extend,f,keepdata)) |
| 9876 | { | ||
| 9877 | ✗ | return qe_invalid; | |
| 9878 | } | ||
| 9879 | |||
| 9880 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(keepdata) |
| 9881 | { | ||
| 9882 | 276 | stabspr[i][spr_tile]=(int32_t)tile; | |
| 9883 | 276 | stabspr[i][spr_flip]=(int32_t)flip; | |
| 9884 | 276 | stabspr[i][spr_extend]=(int32_t)extend; | |
| 9885 | 276 | } | |
| 9886 | 276 | } | |
| 9887 | |||
| 9888 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 69 times.
|
345 | for(int32_t i=0; i<4; i++) |
| 9889 | { | ||
| 9890 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_igetw(&tile,f,keepdata)) |
| 9891 | { | ||
| 9892 | ✗ | return qe_invalid; | |
| 9893 | } | ||
| 9894 | |||
| 9895 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&flip,f,keepdata)) |
| 9896 | { | ||
| 9897 | ✗ | return qe_invalid; | |
| 9898 | } | ||
| 9899 | |||
| 9900 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&extend,f,keepdata)) |
| 9901 | { | ||
| 9902 | ✗ | return qe_invalid; | |
| 9903 | } | ||
| 9904 | |||
| 9905 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(keepdata) |
| 9906 | { | ||
| 9907 | 276 | slashspr[i][spr_tile]=(int32_t)tile; | |
| 9908 | 276 | slashspr[i][spr_flip]=(int32_t)flip; | |
| 9909 | 276 | slashspr[i][spr_extend]=(int32_t)extend; | |
| 9910 | 276 | } | |
| 9911 | 276 | } | |
| 9912 | |||
| 9913 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 69 times.
|
345 | for(int32_t i=0; i<4; i++) |
| 9914 | { | ||
| 9915 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_igetw(&tile,f,keepdata)) |
| 9916 | { | ||
| 9917 | ✗ | return qe_invalid; | |
| 9918 | } | ||
| 9919 | |||
| 9920 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&flip,f,keepdata)) |
| 9921 | { | ||
| 9922 | ✗ | return qe_invalid; | |
| 9923 | } | ||
| 9924 | |||
| 9925 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&extend,f,keepdata)) |
| 9926 | { | ||
| 9927 | ✗ | return qe_invalid; | |
| 9928 | } | ||
| 9929 | |||
| 9930 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(keepdata) |
| 9931 | { | ||
| 9932 | 276 | floatspr[i][spr_tile]=(int32_t)tile; | |
| 9933 | 276 | floatspr[i][spr_flip]=(int32_t)flip; | |
| 9934 | 276 | floatspr[i][spr_extend]=(int32_t)extend; | |
| 9935 | 276 | } | |
| 9936 | 276 | } | |
| 9937 | |||
| 9938 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if(v_herosprites>1) |
| 9939 | { | ||
| 9940 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 69 times.
|
345 | for(int32_t i=0; i<4; i++) |
| 9941 | { | ||
| 9942 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_igetw(&tile,f,keepdata)) |
| 9943 | { | ||
| 9944 | ✗ | return qe_invalid; | |
| 9945 | } | ||
| 9946 | |||
| 9947 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&flip,f,keepdata)) |
| 9948 | { | ||
| 9949 | ✗ | return qe_invalid; | |
| 9950 | } | ||
| 9951 | |||
| 9952 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&extend,f,keepdata)) |
| 9953 | { | ||
| 9954 | ✗ | return qe_invalid; | |
| 9955 | } | ||
| 9956 | |||
| 9957 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(keepdata) |
| 9958 | { | ||
| 9959 | 276 | swimspr[i][spr_tile]=(int32_t)tile; | |
| 9960 | 276 | swimspr[i][spr_flip]=(int32_t)flip; | |
| 9961 | 276 | swimspr[i][spr_extend]=(int32_t)extend; | |
| 9962 | 276 | } | |
| 9963 | 276 | } | |
| 9964 | 69 | } | |
| 9965 | |||
| 9966 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 69 times.
|
345 | for(int32_t i=0; i<4; i++) |
| 9967 | { | ||
| 9968 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_igetw(&tile,f,keepdata)) |
| 9969 | { | ||
| 9970 | ✗ | return qe_invalid; | |
| 9971 | } | ||
| 9972 | |||
| 9973 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&flip,f,keepdata)) |
| 9974 | { | ||
| 9975 | ✗ | return qe_invalid; | |
| 9976 | } | ||
| 9977 | |||
| 9978 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&extend,f,keepdata)) |
| 9979 | { | ||
| 9980 | ✗ | return qe_invalid; | |
| 9981 | } | ||
| 9982 | |||
| 9983 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(keepdata) |
| 9984 | { | ||
| 9985 | 276 | divespr[i][spr_tile]=(int32_t)tile; | |
| 9986 | 276 | divespr[i][spr_flip]=(int32_t)flip; | |
| 9987 | 276 | divespr[i][spr_extend]=(int32_t)extend; | |
| 9988 | 276 | } | |
| 9989 | 276 | } | |
| 9990 | |||
| 9991 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 69 times.
|
345 | for(int32_t i=0; i<4; i++) |
| 9992 | { | ||
| 9993 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_igetw(&tile,f,keepdata)) |
| 9994 | { | ||
| 9995 | ✗ | return qe_invalid; | |
| 9996 | } | ||
| 9997 | |||
| 9998 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&flip,f,keepdata)) |
| 9999 | { | ||
| 10000 | ✗ | return qe_invalid; | |
| 10001 | } | ||
| 10002 | |||
| 10003 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&extend,f,keepdata)) |
| 10004 | { | ||
| 10005 | ✗ | return qe_invalid; | |
| 10006 | } | ||
| 10007 | |||
| 10008 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(keepdata) |
| 10009 | { | ||
| 10010 | 276 | poundspr[i][spr_tile]=(int32_t)tile; | |
| 10011 | 276 | poundspr[i][spr_flip]=(int32_t)flip; | |
| 10012 | 276 | poundspr[i][spr_extend]=(int32_t)extend; | |
| 10013 | 276 | } | |
| 10014 | 276 | } | |
| 10015 | |||
| 10016 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | if(!p_igetw(&tile,f,keepdata)) |
| 10017 | { | ||
| 10018 | ✗ | return qe_invalid; | |
| 10019 | } | ||
| 10020 | |||
| 10021 | 69 | flip=0; | |
| 10022 | |||
| 10023 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if(v_herosprites>0) |
| 10024 | { | ||
| 10025 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | if(!p_getc(&flip,f,keepdata)) |
| 10026 | { | ||
| 10027 | ✗ | return qe_invalid; | |
| 10028 | } | ||
| 10029 | 69 | } | |
| 10030 | |||
| 10031 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | if(!p_getc(&extend,f,keepdata)) |
| 10032 | { | ||
| 10033 | ✗ | return qe_invalid; | |
| 10034 | } | ||
| 10035 | |||
| 10036 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if(keepdata) |
| 10037 | { | ||
| 10038 | 69 | castingspr[spr_tile]=(int32_t)tile; | |
| 10039 | 69 | castingspr[spr_flip]=(int32_t)flip; | |
| 10040 | 69 | castingspr[spr_extend]=(int32_t)extend; | |
| 10041 | 69 | } | |
| 10042 | |||
| 10043 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | if(v_herosprites>0) |
| 10044 | { | ||
| 10045 | 69 | int32_t num_holdsprs = (v_herosprites > 6 ? 3 : 2); | |
| 10046 |
2/2✓ Branch 0 taken 138 times.
✓ Branch 1 taken 69 times.
|
207 | for(int32_t i=0; i<2; i++) |
| 10047 | { | ||
| 10048 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 138 times.
|
414 | for(int32_t j=0; j<num_holdsprs; j++) |
| 10049 | { | ||
| 10050 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_igetw(&tile,f,keepdata)) |
| 10051 | { | ||
| 10052 | ✗ | return qe_invalid; | |
| 10053 | } | ||
| 10054 | |||
| 10055 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&flip,f,keepdata)) |
| 10056 | { | ||
| 10057 | ✗ | return qe_invalid; | |
| 10058 | } | ||
| 10059 | |||
| 10060 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&extend,f,keepdata)) |
| 10061 | { | ||
| 10062 | ✗ | return qe_invalid; | |
| 10063 | } | ||
| 10064 | |||
| 10065 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(keepdata) |
| 10066 | { | ||
| 10067 | 276 | holdspr[i][j][spr_tile]=(int32_t)tile; | |
| 10068 | 276 | holdspr[i][j][spr_flip]=(int32_t)flip; | |
| 10069 | 276 | holdspr[i][j][spr_extend]=(int32_t)extend; | |
| 10070 | 276 | } | |
| 10071 | 276 | } | |
| 10072 | 138 | } | |
| 10073 | 69 | } | |
| 10074 | else | ||
| 10075 | { | ||
| 10076 | ✗ | for(int32_t i=0; i<2; i++) | |
| 10077 | { | ||
| 10078 | ✗ | if(!p_igetw(&tile,f,keepdata)) | |
| 10079 | { | ||
| 10080 | ✗ | return qe_invalid; | |
| 10081 | } | ||
| 10082 | |||
| 10083 | ✗ | if(!p_igetw(&tile2,f,keepdata)) | |
| 10084 | { | ||
| 10085 | ✗ | return qe_invalid; | |
| 10086 | } | ||
| 10087 | |||
| 10088 | ✗ | if(!p_getc(&extend,f,keepdata)) | |
| 10089 | { | ||
| 10090 | ✗ | return qe_invalid; | |
| 10091 | } | ||
| 10092 | |||
| 10093 | ✗ | if(keepdata) | |
| 10094 | { | ||
| 10095 | ✗ | holdspr[i][spr_hold1][spr_tile]=(int32_t)tile; | |
| 10096 | ✗ | holdspr[i][spr_hold1][spr_flip]=(int32_t)flip; | |
| 10097 | ✗ | holdspr[i][spr_hold1][spr_extend]=(int32_t)extend; | |
| 10098 | ✗ | holdspr[i][spr_hold2][spr_tile]=(int32_t)tile2; | |
| 10099 | ✗ | holdspr[i][spr_hold2][spr_flip]=(int32_t)flip; | |
| 10100 | ✗ | holdspr[i][spr_hold2][spr_extend]=(int32_t)extend; | |
| 10101 | } | ||
| 10102 | } | ||
| 10103 | } | ||
| 10104 | |||
| 10105 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if(v_herosprites>2) |
| 10106 | { | ||
| 10107 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 69 times.
|
345 | for(int32_t i=0; i<4; i++) |
| 10108 | { | ||
| 10109 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_igetw(&tile,f,keepdata)) |
| 10110 | { | ||
| 10111 | ✗ | return qe_invalid; | |
| 10112 | } | ||
| 10113 | |||
| 10114 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&flip,f,keepdata)) |
| 10115 | { | ||
| 10116 | ✗ | return qe_invalid; | |
| 10117 | } | ||
| 10118 | |||
| 10119 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&extend,f,keepdata)) |
| 10120 | { | ||
| 10121 | ✗ | return qe_invalid; | |
| 10122 | } | ||
| 10123 | |||
| 10124 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(keepdata) |
| 10125 | { | ||
| 10126 | 276 | jumpspr[i][spr_tile]=(int32_t)tile; | |
| 10127 | 276 | jumpspr[i][spr_flip]=(int32_t)flip; | |
| 10128 | 276 | jumpspr[i][spr_extend]=(int32_t)extend; | |
| 10129 | 276 | } | |
| 10130 | 276 | } | |
| 10131 | 69 | } | |
| 10132 | |||
| 10133 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if(v_herosprites>3) |
| 10134 | { | ||
| 10135 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 69 times.
|
345 | for(int32_t i=0; i<4; i++) |
| 10136 | { | ||
| 10137 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_igetw(&tile,f,keepdata)) |
| 10138 | { | ||
| 10139 | ✗ | return qe_invalid; | |
| 10140 | } | ||
| 10141 | |||
| 10142 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&flip,f,keepdata)) |
| 10143 | { | ||
| 10144 | ✗ | return qe_invalid; | |
| 10145 | } | ||
| 10146 | |||
| 10147 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&extend,f,keepdata)) |
| 10148 | { | ||
| 10149 | ✗ | return qe_invalid; | |
| 10150 | } | ||
| 10151 | |||
| 10152 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(keepdata) |
| 10153 | { | ||
| 10154 | 276 | chargespr[i][spr_tile]=(int32_t)tile; | |
| 10155 | 276 | chargespr[i][spr_flip]=(int32_t)flip; | |
| 10156 | 276 | chargespr[i][spr_extend]=(int32_t)extend; | |
| 10157 | 276 | } | |
| 10158 | 276 | } | |
| 10159 | 69 | } | |
| 10160 | |||
| 10161 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if(v_herosprites>4) |
| 10162 | { | ||
| 10163 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if(!p_getc(&dummy_byte,f,keepdata)) |
| 10164 | { | ||
| 10165 | ✗ | return qe_invalid; | |
| 10166 | } | ||
| 10167 | |||
| 10168 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if(keepdata) |
| 10169 | { | ||
| 10170 | 69 | zinit.hero_swim_speed=(byte)dummy_byte; | |
| 10171 | 69 | } | |
| 10172 | 69 | } | |
| 10173 | |||
| 10174 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | if(keepdata) |
| 10175 | { | ||
| 10176 | 69 | memset(frozenspr, 0, sizeof(frozenspr)); | |
| 10177 | 69 | memset(frozen_waterspr, 0, sizeof(frozen_waterspr)); | |
| 10178 | 69 | memset(onfirespr, 0, sizeof(onfirespr)); | |
| 10179 | 69 | memset(onfire_waterspr, 0, sizeof(onfire_waterspr)); | |
| 10180 | 69 | memset(diggingspr, 0, sizeof(diggingspr)); | |
| 10181 | 69 | memset(usingrodspr, 0, sizeof(usingrodspr)); | |
| 10182 | 69 | memset(usingcanespr, 0, sizeof(usingcanespr)); | |
| 10183 | 69 | memset(pushingspr, 0, sizeof(pushingspr)); | |
| 10184 | 69 | memset(liftingspr, 0, sizeof(liftingspr)); | |
| 10185 | 69 | memset(liftingwalkspr, 0, sizeof(liftingwalkspr)); | |
| 10186 | 69 | memset(stunnedspr, 0, sizeof(stunnedspr)); | |
| 10187 | 69 | memset(stunned_waterspr, 0, sizeof(stunned_waterspr)); | |
| 10188 | 69 | memset(fallingspr, 0, sizeof(fallingspr)); | |
| 10189 | 69 | memset(shockedspr, 0, sizeof(shockedspr)); | |
| 10190 | 69 | memset(shocked_waterspr, 0, sizeof(shocked_waterspr)); | |
| 10191 | 69 | memset(pullswordspr, 0, sizeof(pullswordspr)); | |
| 10192 | 69 | memset(readingspr, 0, sizeof(readingspr)); | |
| 10193 | 69 | memset(slash180spr, 0, sizeof(slash180spr)); | |
| 10194 | 69 | memset(slashZ4spr, 0, sizeof(slashZ4spr)); | |
| 10195 | 69 | memset(dashspr, 0, sizeof(dashspr)); | |
| 10196 | 69 | memset(bonkspr, 0, sizeof(bonkspr)); | |
| 10197 | 69 | memset(medallionsprs, 0, sizeof(medallionsprs)); | |
| 10198 | 69 | memset(holdspr[0][2], 0, sizeof(holdspr[0][2])); //Sword hold (Land) | |
| 10199 | 69 | memset(holdspr[1][2], 0, sizeof(holdspr[1][2])); //Sword hold (Water) | |
| 10200 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 69 times.
|
345 | for(int32_t q = 0; q < 4; ++q) |
| 10201 | { | ||
| 10202 |
2/2✓ Branch 0 taken 828 times.
✓ Branch 1 taken 276 times.
|
1104 | for(int32_t p = 0; p < 3; ++p) |
| 10203 | { | ||
| 10204 | 828 | drowningspr[q][p] = divespr[q][p]; | |
| 10205 | 828 | drowning_lavaspr[q][p] = divespr[q][p]; | |
| 10206 | 828 | } | |
| 10207 | 276 | } | |
| 10208 | 69 | memset(sideswimspr, 0, sizeof(sideswimspr)); | |
| 10209 | 69 | memset(sideswimslashspr, 0, sizeof(sideswimslashspr)); | |
| 10210 | 69 | memset(sideswimstabspr, 0, sizeof(sideswimstabspr)); | |
| 10211 | 69 | memset(sideswimpoundspr, 0, sizeof(sideswimpoundspr)); | |
| 10212 | 69 | memset(sideswimchargespr, 0, sizeof(sideswimchargespr)); | |
| 10213 | 69 | memset(sideswimholdspr, 0, sizeof(sideswimholdspr)); | |
| 10214 | 69 | memset(sidedrowningspr, 0, sizeof(sidedrowningspr)); | |
| 10215 | 69 | } | |
| 10216 | 69 | } | |
| 10217 | |||
| 10218 | 69 | return 0; | |
| 10219 | 69 | } | |
| 10220 | |||
| 10221 | 1360 | void setSprite(int32_t* arr, int32_t tile, int32_t flip, int32_t ext) | |
| 10222 | { | ||
| 10223 | 1360 | arr[spr_tile] = tile; | |
| 10224 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1360 times.
|
1360 | arr[spr_flip] = (flip > 3 ? 0 : flip); |
| 10225 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1360 times.
|
1360 | arr[spr_extend] = (ext > 2 ? 0 : ext); |
| 10226 | 1360 | } | |
| 10227 | //Used to read the player sprites as int32_t, not word. | ||
| 10228 | 8 | int32_t readherosprites3(PACKFILE *f, int32_t v_herosprites, int32_t cv_herosprites, bool keepdata) | |
| 10229 | { | ||
| 10230 | //these are here to bypass compiler warnings about unused arguments | ||
| 10231 | 8 | cv_herosprites=cv_herosprites; | |
| 10232 | |||
| 10233 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(keepdata) |
| 10234 | { | ||
| 10235 | 8 | zinit.hero_swim_speed=67; //default | |
| 10236 | 8 | setupherotiles(zinit.heroAnimationStyle); | |
| 10237 | 8 | setupherodefenses(); | |
| 10238 | 8 | setupherooffsets(); | |
| 10239 | 8 | } | |
| 10240 | |||
| 10241 | int32_t tile, tile2; | ||
| 10242 | byte flip, extend, dummy_byte; | ||
| 10243 | |||
| 10244 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(v_herosprites>=0) |
| 10245 | { | ||
| 10246 | |||
| 10247 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t i=0; i<4; i++) |
| 10248 | { | ||
| 10249 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10250 | { | ||
| 10251 | ✗ | return qe_invalid; | |
| 10252 | } | ||
| 10253 | |||
| 10254 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10255 | { | ||
| 10256 | ✗ | return qe_invalid; | |
| 10257 | } | ||
| 10258 | |||
| 10259 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10260 | { | ||
| 10261 | ✗ | return qe_invalid; | |
| 10262 | } | ||
| 10263 | |||
| 10264 | 32 | if(keepdata) | |
| 10265 | { | ||
| 10266 | 32 | setSprite(walkspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10267 | 32 | } | |
| 10268 | 32 | } | |
| 10269 | |||
| 10270 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t i=0; i<4; i++) |
| 10271 | { | ||
| 10272 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10273 | { | ||
| 10274 | ✗ | return qe_invalid; | |
| 10275 | } | ||
| 10276 | |||
| 10277 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10278 | { | ||
| 10279 | ✗ | return qe_invalid; | |
| 10280 | } | ||
| 10281 | |||
| 10282 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10283 | { | ||
| 10284 | ✗ | return qe_invalid; | |
| 10285 | } | ||
| 10286 | |||
| 10287 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10288 | { | ||
| 10289 | 32 | setSprite(stabspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10290 | 32 | } | |
| 10291 | 32 | } | |
| 10292 | |||
| 10293 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t i=0; i<4; i++) |
| 10294 | { | ||
| 10295 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10296 | { | ||
| 10297 | ✗ | return qe_invalid; | |
| 10298 | } | ||
| 10299 | |||
| 10300 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10301 | { | ||
| 10302 | ✗ | return qe_invalid; | |
| 10303 | } | ||
| 10304 | |||
| 10305 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10306 | { | ||
| 10307 | ✗ | return qe_invalid; | |
| 10308 | } | ||
| 10309 | |||
| 10310 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10311 | { | ||
| 10312 | 32 | setSprite(slashspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10313 | 32 | } | |
| 10314 | 32 | } | |
| 10315 | |||
| 10316 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t i=0; i<4; i++) |
| 10317 | { | ||
| 10318 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10319 | { | ||
| 10320 | ✗ | return qe_invalid; | |
| 10321 | } | ||
| 10322 | |||
| 10323 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10324 | { | ||
| 10325 | ✗ | return qe_invalid; | |
| 10326 | } | ||
| 10327 | |||
| 10328 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10329 | { | ||
| 10330 | ✗ | return qe_invalid; | |
| 10331 | } | ||
| 10332 | |||
| 10333 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10334 | { | ||
| 10335 | 32 | setSprite(floatspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10336 | 32 | } | |
| 10337 | 32 | } | |
| 10338 | |||
| 10339 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(v_herosprites>1) |
| 10340 | { | ||
| 10341 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t i=0; i<4; i++) |
| 10342 | { | ||
| 10343 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10344 | { | ||
| 10345 | ✗ | return qe_invalid; | |
| 10346 | } | ||
| 10347 | |||
| 10348 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10349 | { | ||
| 10350 | ✗ | return qe_invalid; | |
| 10351 | } | ||
| 10352 | |||
| 10353 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10354 | { | ||
| 10355 | ✗ | return qe_invalid; | |
| 10356 | } | ||
| 10357 | |||
| 10358 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10359 | { | ||
| 10360 | 32 | setSprite(swimspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10361 | 32 | } | |
| 10362 | 32 | } | |
| 10363 | 8 | } | |
| 10364 | |||
| 10365 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t i=0; i<4; i++) |
| 10366 | { | ||
| 10367 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10368 | { | ||
| 10369 | ✗ | return qe_invalid; | |
| 10370 | } | ||
| 10371 | |||
| 10372 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10373 | { | ||
| 10374 | ✗ | return qe_invalid; | |
| 10375 | } | ||
| 10376 | |||
| 10377 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10378 | { | ||
| 10379 | ✗ | return qe_invalid; | |
| 10380 | } | ||
| 10381 | |||
| 10382 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10383 | { | ||
| 10384 | 32 | setSprite(divespr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10385 | 32 | } | |
| 10386 | 32 | } | |
| 10387 | |||
| 10388 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t i=0; i<4; i++) |
| 10389 | { | ||
| 10390 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10391 | { | ||
| 10392 | ✗ | return qe_invalid; | |
| 10393 | } | ||
| 10394 | |||
| 10395 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10396 | { | ||
| 10397 | ✗ | return qe_invalid; | |
| 10398 | } | ||
| 10399 | |||
| 10400 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10401 | { | ||
| 10402 | ✗ | return qe_invalid; | |
| 10403 | } | ||
| 10404 | |||
| 10405 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10406 | { | ||
| 10407 | 32 | setSprite(poundspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10408 | 32 | } | |
| 10409 | 32 | } | |
| 10410 | |||
| 10411 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(!p_igetl(&tile,f,keepdata)) |
| 10412 | { | ||
| 10413 | ✗ | return qe_invalid; | |
| 10414 | } | ||
| 10415 | |||
| 10416 | 8 | flip=0; | |
| 10417 | |||
| 10418 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(v_herosprites>0) |
| 10419 | { | ||
| 10420 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(!p_getc(&flip,f,keepdata)) |
| 10421 | { | ||
| 10422 | ✗ | return qe_invalid; | |
| 10423 | } | ||
| 10424 | 8 | } | |
| 10425 | |||
| 10426 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(!p_getc(&extend,f,keepdata)) |
| 10427 | { | ||
| 10428 | ✗ | return qe_invalid; | |
| 10429 | } | ||
| 10430 | |||
| 10431 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(keepdata) |
| 10432 | { | ||
| 10433 | 8 | setSprite(castingspr, int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10434 | 8 | } | |
| 10435 | |||
| 10436 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(v_herosprites>0) |
| 10437 | { | ||
| 10438 | 8 | int32_t num_holdsprs = (v_herosprites > 6 ? 3 : 2); | |
| 10439 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 8 times.
|
24 | for(int32_t i=0; i<2; i++) |
| 10440 | { | ||
| 10441 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 16 times.
|
64 | for(int32_t j=0; j<num_holdsprs; j++) |
| 10442 | { | ||
| 10443 |
1/2✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
|
48 | if(!p_igetl(&tile,f,keepdata)) |
| 10444 | { | ||
| 10445 | ✗ | return qe_invalid; | |
| 10446 | } | ||
| 10447 | |||
| 10448 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if(!p_getc(&flip,f,keepdata)) |
| 10449 | { | ||
| 10450 | ✗ | return qe_invalid; | |
| 10451 | } | ||
| 10452 | |||
| 10453 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if(!p_getc(&extend,f,keepdata)) |
| 10454 | { | ||
| 10455 | ✗ | return qe_invalid; | |
| 10456 | } | ||
| 10457 | |||
| 10458 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if(keepdata) |
| 10459 | { | ||
| 10460 | 48 | setSprite(holdspr[i][j], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10461 | 48 | } | |
| 10462 | 48 | } | |
| 10463 | 16 | } | |
| 10464 | 8 | } | |
| 10465 | else | ||
| 10466 | { | ||
| 10467 | ✗ | for(int32_t i=0; i<2; i++) | |
| 10468 | { | ||
| 10469 | ✗ | if(!p_igetl(&tile,f,keepdata)) | |
| 10470 | { | ||
| 10471 | ✗ | return qe_invalid; | |
| 10472 | } | ||
| 10473 | |||
| 10474 | ✗ | if(!p_igetl(&tile2,f,keepdata)) | |
| 10475 | { | ||
| 10476 | ✗ | return qe_invalid; | |
| 10477 | } | ||
| 10478 | |||
| 10479 | ✗ | if(!p_getc(&extend,f,keepdata)) | |
| 10480 | { | ||
| 10481 | ✗ | return qe_invalid; | |
| 10482 | } | ||
| 10483 | |||
| 10484 | ✗ | if(keepdata) | |
| 10485 | { | ||
| 10486 | ✗ | setSprite(holdspr[i][spr_hold1], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10487 | ✗ | setSprite(holdspr[i][spr_hold2], int32_t(tile2), int32_t(flip), int32_t(extend)); | |
| 10488 | } | ||
| 10489 | } | ||
| 10490 | } | ||
| 10491 | |||
| 10492 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(v_herosprites>2) |
| 10493 | { | ||
| 10494 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t i=0; i<4; i++) |
| 10495 | { | ||
| 10496 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10497 | { | ||
| 10498 | ✗ | return qe_invalid; | |
| 10499 | } | ||
| 10500 | |||
| 10501 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10502 | { | ||
| 10503 | ✗ | return qe_invalid; | |
| 10504 | } | ||
| 10505 | |||
| 10506 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10507 | { | ||
| 10508 | ✗ | return qe_invalid; | |
| 10509 | } | ||
| 10510 | |||
| 10511 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10512 | { | ||
| 10513 | 32 | setSprite(jumpspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10514 | 32 | } | |
| 10515 | 32 | } | |
| 10516 | 8 | } | |
| 10517 | |||
| 10518 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(v_herosprites>3) |
| 10519 | { | ||
| 10520 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t i=0; i<4; i++) |
| 10521 | { | ||
| 10522 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10523 | { | ||
| 10524 | ✗ | return qe_invalid; | |
| 10525 | } | ||
| 10526 | |||
| 10527 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10528 | { | ||
| 10529 | ✗ | return qe_invalid; | |
| 10530 | } | ||
| 10531 | |||
| 10532 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10533 | { | ||
| 10534 | ✗ | return qe_invalid; | |
| 10535 | } | ||
| 10536 | |||
| 10537 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10538 | { | ||
| 10539 | 32 | setSprite(chargespr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10540 | 32 | } | |
| 10541 | 32 | } | |
| 10542 | 8 | } | |
| 10543 | |||
| 10544 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(v_herosprites>4) |
| 10545 | { | ||
| 10546 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(!p_getc(&dummy_byte,f,keepdata)) |
| 10547 | { | ||
| 10548 | ✗ | return qe_invalid; | |
| 10549 | } | ||
| 10550 | |||
| 10551 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(keepdata) |
| 10552 | { | ||
| 10553 | 8 | zinit.hero_swim_speed=(byte)dummy_byte; | |
| 10554 | 8 | } | |
| 10555 | 8 | } | |
| 10556 | |||
| 10557 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(v_herosprites>6) |
| 10558 | { | ||
| 10559 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10560 | { | ||
| 10561 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10562 | ✗ | return qe_invalid; | |
| 10563 | |||
| 10564 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10565 | ✗ | return qe_invalid; | |
| 10566 | |||
| 10567 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10568 | ✗ | return qe_invalid; | |
| 10569 | |||
| 10570 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10571 | { | ||
| 10572 | 32 | setSprite(frozenspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10573 | 32 | } | |
| 10574 | 32 | } | |
| 10575 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10576 | { | ||
| 10577 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10578 | ✗ | return qe_invalid; | |
| 10579 | |||
| 10580 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10581 | ✗ | return qe_invalid; | |
| 10582 | |||
| 10583 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10584 | ✗ | return qe_invalid; | |
| 10585 | |||
| 10586 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10587 | { | ||
| 10588 | 32 | setSprite(frozen_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10589 | 32 | } | |
| 10590 | 32 | } | |
| 10591 | |||
| 10592 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10593 | { | ||
| 10594 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10595 | ✗ | return qe_invalid; | |
| 10596 | |||
| 10597 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10598 | ✗ | return qe_invalid; | |
| 10599 | |||
| 10600 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10601 | ✗ | return qe_invalid; | |
| 10602 | |||
| 10603 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10604 | { | ||
| 10605 | 32 | setSprite(onfirespr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10606 | 32 | } | |
| 10607 | 32 | } | |
| 10608 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10609 | { | ||
| 10610 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10611 | ✗ | return qe_invalid; | |
| 10612 | |||
| 10613 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10614 | ✗ | return qe_invalid; | |
| 10615 | |||
| 10616 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10617 | ✗ | return qe_invalid; | |
| 10618 | |||
| 10619 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10620 | { | ||
| 10621 | 32 | setSprite(onfire_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10622 | 32 | } | |
| 10623 | 32 | } | |
| 10624 | |||
| 10625 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10626 | { | ||
| 10627 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10628 | ✗ | return qe_invalid; | |
| 10629 | |||
| 10630 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10631 | ✗ | return qe_invalid; | |
| 10632 | |||
| 10633 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10634 | ✗ | return qe_invalid; | |
| 10635 | |||
| 10636 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10637 | { | ||
| 10638 | 32 | setSprite(diggingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10639 | 32 | } | |
| 10640 | 32 | } | |
| 10641 | |||
| 10642 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10643 | { | ||
| 10644 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10645 | ✗ | return qe_invalid; | |
| 10646 | |||
| 10647 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10648 | ✗ | return qe_invalid; | |
| 10649 | |||
| 10650 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10651 | ✗ | return qe_invalid; | |
| 10652 | |||
| 10653 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10654 | { | ||
| 10655 | 32 | setSprite(usingrodspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10656 | 32 | } | |
| 10657 | 32 | } | |
| 10658 | |||
| 10659 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10660 | { | ||
| 10661 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10662 | ✗ | return qe_invalid; | |
| 10663 | |||
| 10664 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10665 | ✗ | return qe_invalid; | |
| 10666 | |||
| 10667 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10668 | ✗ | return qe_invalid; | |
| 10669 | |||
| 10670 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10671 | { | ||
| 10672 | 32 | setSprite(usingcanespr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10673 | 32 | } | |
| 10674 | 32 | } | |
| 10675 | |||
| 10676 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10677 | { | ||
| 10678 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10679 | ✗ | return qe_invalid; | |
| 10680 | |||
| 10681 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10682 | ✗ | return qe_invalid; | |
| 10683 | |||
| 10684 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10685 | ✗ | return qe_invalid; | |
| 10686 | |||
| 10687 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10688 | { | ||
| 10689 | 32 | setSprite(pushingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10690 | 32 | } | |
| 10691 | 32 | } | |
| 10692 | |||
| 10693 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10694 | { | ||
| 10695 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10696 | ✗ | return qe_invalid; | |
| 10697 | |||
| 10698 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10699 | ✗ | return qe_invalid; | |
| 10700 | |||
| 10701 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10702 | ✗ | return qe_invalid; | |
| 10703 | |||
| 10704 | 32 | byte frames = 0; | |
| 10705 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 28 times.
|
32 | if(v_herosprites > 15) |
| 10706 | { | ||
| 10707 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28 times.
|
28 | if(!p_getc(&frames,f,keepdata)) |
| 10708 | ✗ | return qe_invalid; | |
| 10709 | 28 | } | |
| 10710 | |||
| 10711 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10712 | { | ||
| 10713 | 32 | setSprite(liftingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10714 | 32 | liftingspr[q][spr_frames] = frames; | |
| 10715 | 32 | } | |
| 10716 | 32 | } | |
| 10717 | |||
| 10718 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10719 | { | ||
| 10720 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10721 | ✗ | return qe_invalid; | |
| 10722 | |||
| 10723 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10724 | ✗ | return qe_invalid; | |
| 10725 | |||
| 10726 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10727 | ✗ | return qe_invalid; | |
| 10728 | |||
| 10729 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10730 | { | ||
| 10731 | 32 | setSprite(liftingwalkspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10732 | 32 | } | |
| 10733 | 32 | } | |
| 10734 | |||
| 10735 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10736 | { | ||
| 10737 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10738 | ✗ | return qe_invalid; | |
| 10739 | |||
| 10740 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10741 | ✗ | return qe_invalid; | |
| 10742 | |||
| 10743 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10744 | ✗ | return qe_invalid; | |
| 10745 | |||
| 10746 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10747 | { | ||
| 10748 | 32 | setSprite(stunnedspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10749 | 32 | } | |
| 10750 | 32 | } | |
| 10751 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10752 | { | ||
| 10753 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10754 | ✗ | return qe_invalid; | |
| 10755 | |||
| 10756 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10757 | ✗ | return qe_invalid; | |
| 10758 | |||
| 10759 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10760 | ✗ | return qe_invalid; | |
| 10761 | |||
| 10762 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10763 | { | ||
| 10764 | 32 | setSprite(stunned_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10765 | 32 | } | |
| 10766 | 32 | } | |
| 10767 | |||
| 10768 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10769 | { | ||
| 10770 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10771 | ✗ | return qe_invalid; | |
| 10772 | |||
| 10773 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10774 | ✗ | return qe_invalid; | |
| 10775 | |||
| 10776 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10777 | ✗ | return qe_invalid; | |
| 10778 | |||
| 10779 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10780 | { | ||
| 10781 | 32 | setSprite(drowningspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10782 | 32 | } | |
| 10783 | 32 | } | |
| 10784 | |||
| 10785 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10786 | { | ||
| 10787 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10788 | ✗ | return qe_invalid; | |
| 10789 | |||
| 10790 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10791 | ✗ | return qe_invalid; | |
| 10792 | |||
| 10793 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10794 | ✗ | return qe_invalid; | |
| 10795 | |||
| 10796 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10797 | { | ||
| 10798 | 32 | setSprite(drowning_lavaspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10799 | 32 | } | |
| 10800 | 32 | } | |
| 10801 | |||
| 10802 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10803 | { | ||
| 10804 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10805 | ✗ | return qe_invalid; | |
| 10806 | |||
| 10807 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10808 | ✗ | return qe_invalid; | |
| 10809 | |||
| 10810 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10811 | ✗ | return qe_invalid; | |
| 10812 | |||
| 10813 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10814 | { | ||
| 10815 | 32 | setSprite(fallingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10816 | 32 | } | |
| 10817 | 32 | } | |
| 10818 | |||
| 10819 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10820 | { | ||
| 10821 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10822 | ✗ | return qe_invalid; | |
| 10823 | |||
| 10824 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10825 | ✗ | return qe_invalid; | |
| 10826 | |||
| 10827 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10828 | ✗ | return qe_invalid; | |
| 10829 | |||
| 10830 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10831 | { | ||
| 10832 | 32 | setSprite(shockedspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10833 | 32 | } | |
| 10834 | 32 | } | |
| 10835 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10836 | { | ||
| 10837 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10838 | ✗ | return qe_invalid; | |
| 10839 | |||
| 10840 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10841 | ✗ | return qe_invalid; | |
| 10842 | |||
| 10843 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10844 | ✗ | return qe_invalid; | |
| 10845 | |||
| 10846 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10847 | { | ||
| 10848 | 32 | setSprite(shocked_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10849 | 32 | } | |
| 10850 | 32 | } | |
| 10851 | |||
| 10852 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10853 | { | ||
| 10854 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10855 | ✗ | return qe_invalid; | |
| 10856 | |||
| 10857 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10858 | ✗ | return qe_invalid; | |
| 10859 | |||
| 10860 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10861 | ✗ | return qe_invalid; | |
| 10862 | |||
| 10863 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10864 | { | ||
| 10865 | 32 | setSprite(pullswordspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10866 | 32 | } | |
| 10867 | 32 | } | |
| 10868 | |||
| 10869 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10870 | { | ||
| 10871 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10872 | ✗ | return qe_invalid; | |
| 10873 | |||
| 10874 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10875 | ✗ | return qe_invalid; | |
| 10876 | |||
| 10877 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10878 | ✗ | return qe_invalid; | |
| 10879 | |||
| 10880 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10881 | { | ||
| 10882 | 32 | setSprite(readingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10883 | 32 | } | |
| 10884 | 32 | } | |
| 10885 | |||
| 10886 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10887 | { | ||
| 10888 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10889 | ✗ | return qe_invalid; | |
| 10890 | |||
| 10891 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10892 | ✗ | return qe_invalid; | |
| 10893 | |||
| 10894 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10895 | ✗ | return qe_invalid; | |
| 10896 | |||
| 10897 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10898 | { | ||
| 10899 | 32 | setSprite(slash180spr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10900 | 32 | } | |
| 10901 | 32 | } | |
| 10902 | |||
| 10903 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10904 | { | ||
| 10905 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10906 | ✗ | return qe_invalid; | |
| 10907 | |||
| 10908 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10909 | ✗ | return qe_invalid; | |
| 10910 | |||
| 10911 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10912 | ✗ | return qe_invalid; | |
| 10913 | |||
| 10914 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10915 | { | ||
| 10916 | 32 | setSprite(slashZ4spr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10917 | 32 | } | |
| 10918 | 32 | } | |
| 10919 | |||
| 10920 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10921 | { | ||
| 10922 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10923 | ✗ | return qe_invalid; | |
| 10924 | |||
| 10925 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10926 | ✗ | return qe_invalid; | |
| 10927 | |||
| 10928 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10929 | ✗ | return qe_invalid; | |
| 10930 | |||
| 10931 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10932 | { | ||
| 10933 | 32 | setSprite(dashspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10934 | 32 | } | |
| 10935 | 32 | } | |
| 10936 | |||
| 10937 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 10938 | { | ||
| 10939 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 10940 | ✗ | return qe_invalid; | |
| 10941 | |||
| 10942 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 10943 | ✗ | return qe_invalid; | |
| 10944 | |||
| 10945 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 10946 | ✗ | return qe_invalid; | |
| 10947 | |||
| 10948 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 10949 | { | ||
| 10950 | 32 | setSprite(bonkspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10951 | 32 | } | |
| 10952 | 32 | } | |
| 10953 | |||
| 10954 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 8 times.
|
32 | for(int32_t q = 0; q < 3; ++q) //Not directions; number of medallion sprs |
| 10955 | { | ||
| 10956 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_igetl(&tile,f,keepdata)) |
| 10957 | ✗ | return qe_invalid; | |
| 10958 | |||
| 10959 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&flip,f,keepdata)) |
| 10960 | ✗ | return qe_invalid; | |
| 10961 | |||
| 10962 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&extend,f,keepdata)) |
| 10963 | ✗ | return qe_invalid; | |
| 10964 | |||
| 10965 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(keepdata) |
| 10966 | { | ||
| 10967 | 24 | setSprite(medallionsprs[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10968 | 24 | } | |
| 10969 | 24 | } | |
| 10970 | 8 | } | |
| 10971 | ✗ | else if(keepdata) | |
| 10972 | { | ||
| 10973 | ✗ | memset(frozenspr, 0, sizeof(frozenspr)); | |
| 10974 | ✗ | memset(frozen_waterspr, 0, sizeof(frozen_waterspr)); | |
| 10975 | ✗ | memset(onfirespr, 0, sizeof(onfirespr)); | |
| 10976 | ✗ | memset(onfire_waterspr, 0, sizeof(onfire_waterspr)); | |
| 10977 | ✗ | memset(diggingspr, 0, sizeof(diggingspr)); | |
| 10978 | ✗ | memset(usingrodspr, 0, sizeof(usingrodspr)); | |
| 10979 | ✗ | memset(usingcanespr, 0, sizeof(usingcanespr)); | |
| 10980 | ✗ | memset(pushingspr, 0, sizeof(pushingspr)); | |
| 10981 | ✗ | memset(liftingspr, 0, sizeof(liftingspr)); | |
| 10982 | ✗ | memset(liftingwalkspr, 0, sizeof(liftingwalkspr)); | |
| 10983 | ✗ | memset(stunnedspr, 0, sizeof(stunnedspr)); | |
| 10984 | ✗ | memset(stunned_waterspr, 0, sizeof(stunned_waterspr)); | |
| 10985 | ✗ | memset(fallingspr, 0, sizeof(fallingspr)); | |
| 10986 | ✗ | memset(shockedspr, 0, sizeof(shockedspr)); | |
| 10987 | ✗ | memset(shocked_waterspr, 0, sizeof(shocked_waterspr)); | |
| 10988 | ✗ | memset(pullswordspr, 0, sizeof(pullswordspr)); | |
| 10989 | ✗ | memset(readingspr, 0, sizeof(readingspr)); | |
| 10990 | ✗ | memset(slash180spr, 0, sizeof(slash180spr)); | |
| 10991 | ✗ | memset(slashZ4spr, 0, sizeof(slashZ4spr)); | |
| 10992 | ✗ | memset(dashspr, 0, sizeof(dashspr)); | |
| 10993 | ✗ | memset(bonkspr, 0, sizeof(bonkspr)); | |
| 10994 | ✗ | memset(medallionsprs, 0, sizeof(medallionsprs)); | |
| 10995 | ✗ | memset(holdspr[0][2], 0, sizeof(holdspr[0][2])); //Sword hold (Land) | |
| 10996 | ✗ | memset(holdspr[1][2], 0, sizeof(holdspr[1][2])); //Sword hold (Water) | |
| 10997 | ✗ | for(int32_t q = 0; q < 4; ++q) | |
| 10998 | { | ||
| 10999 | ✗ | for(int32_t p = 0; p < 3; ++p) | |
| 11000 | { | ||
| 11001 | ✗ | drowningspr[q][p] = divespr[q][p]; | |
| 11002 | ✗ | drowning_lavaspr[q][p] = divespr[q][p]; | |
| 11003 | } | ||
| 11004 | } | ||
| 11005 | } | ||
| 11006 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if (v_herosprites > 8) |
| 11007 | { | ||
| 11008 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 11009 | { | ||
| 11010 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 11011 | ✗ | return qe_invalid; | |
| 11012 | |||
| 11013 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 11014 | ✗ | return qe_invalid; | |
| 11015 | |||
| 11016 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 11017 | ✗ | return qe_invalid; | |
| 11018 | |||
| 11019 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 11020 | { | ||
| 11021 | 32 | setSprite(sideswimspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11022 | 32 | } | |
| 11023 | 32 | } | |
| 11024 | 8 | } | |
| 11025 | ✗ | else if (keepdata) | |
| 11026 | { | ||
| 11027 | ✗ | memset(sideswimspr, 0, sizeof(sideswimspr)); | |
| 11028 | } | ||
| 11029 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if (v_herosprites > 9) |
| 11030 | { | ||
| 11031 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 11032 | { | ||
| 11033 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 11034 | ✗ | return qe_invalid; | |
| 11035 | |||
| 11036 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 11037 | ✗ | return qe_invalid; | |
| 11038 | |||
| 11039 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 11040 | ✗ | return qe_invalid; | |
| 11041 | |||
| 11042 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 11043 | { | ||
| 11044 | 32 | setSprite(sideswimslashspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11045 | 32 | } | |
| 11046 | 32 | } | |
| 11047 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 11048 | { | ||
| 11049 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 11050 | ✗ | return qe_invalid; | |
| 11051 | |||
| 11052 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 11053 | ✗ | return qe_invalid; | |
| 11054 | |||
| 11055 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 11056 | ✗ | return qe_invalid; | |
| 11057 | |||
| 11058 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 11059 | { | ||
| 11060 | 32 | setSprite(sideswimstabspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11061 | 32 | } | |
| 11062 | 32 | } | |
| 11063 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 11064 | { | ||
| 11065 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 11066 | ✗ | return qe_invalid; | |
| 11067 | |||
| 11068 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 11069 | ✗ | return qe_invalid; | |
| 11070 | |||
| 11071 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 11072 | ✗ | return qe_invalid; | |
| 11073 | |||
| 11074 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 11075 | { | ||
| 11076 | 32 | setSprite(sideswimpoundspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11077 | 32 | } | |
| 11078 | 32 | } | |
| 11079 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 11080 | { | ||
| 11081 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 11082 | ✗ | return qe_invalid; | |
| 11083 | |||
| 11084 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 11085 | ✗ | return qe_invalid; | |
| 11086 | |||
| 11087 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 11088 | ✗ | return qe_invalid; | |
| 11089 | |||
| 11090 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 11091 | { | ||
| 11092 | 32 | setSprite(sideswimchargespr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11093 | 32 | } | |
| 11094 | 32 | } | |
| 11095 | 8 | } | |
| 11096 | ✗ | else if (keepdata) | |
| 11097 | { | ||
| 11098 | ✗ | memset(sideswimslashspr, 0, sizeof(sideswimslashspr)); | |
| 11099 | ✗ | memset(sideswimstabspr, 0, sizeof(sideswimstabspr)); | |
| 11100 | ✗ | memset(sideswimpoundspr, 0, sizeof(sideswimpoundspr)); | |
| 11101 | ✗ | memset(sideswimchargespr, 0, sizeof(sideswimchargespr)); | |
| 11102 | } | ||
| 11103 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if (v_herosprites > 10) |
| 11104 | { | ||
| 11105 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 11106 | { | ||
| 11107 | int32_t hmr; | ||
| 11108 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_igetl(&hmr,f,keepdata)) |
| 11109 | ✗ | return qe_invalid; | |
| 11110 | |||
| 11111 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 11112 | { | ||
| 11113 | 32 | hammeroffsets[q] = hmr; | |
| 11114 | 32 | } | |
| 11115 | 32 | } | |
| 11116 | 8 | } | |
| 11117 | ✗ | else if (keepdata) | |
| 11118 | { | ||
| 11119 | ✗ | for(int32_t q = 0; q < 4; ++q) hammeroffsets[q] = 0; | |
| 11120 | } | ||
| 11121 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if (v_herosprites > 11) |
| 11122 | { | ||
| 11123 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 8 times.
|
32 | for(int32_t q = 0; q < 3; ++q) |
| 11124 | { | ||
| 11125 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_igetl(&tile,f,keepdata)) |
| 11126 | ✗ | return qe_invalid; | |
| 11127 | |||
| 11128 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(!p_getc(&flip,f,keepdata)) |
| 11129 | ✗ | return qe_invalid; | |
| 11130 | |||
| 11131 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(!p_getc(&extend,f,keepdata)) |
| 11132 | ✗ | return qe_invalid; | |
| 11133 | |||
| 11134 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(keepdata) |
| 11135 | { | ||
| 11136 | 24 | setSprite(sideswimholdspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11137 | 24 | } | |
| 11138 | 24 | } | |
| 11139 | 8 | } | |
| 11140 | ✗ | else if (keepdata) | |
| 11141 | { | ||
| 11142 | ✗ | memset(sideswimholdspr, 0, sizeof(sideswimholdspr)); | |
| 11143 | } | ||
| 11144 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if (v_herosprites > 12) |
| 11145 | { | ||
| 11146 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(!p_igetl(&tile,f,keepdata)) |
| 11147 | ✗ | return qe_invalid; | |
| 11148 | |||
| 11149 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(!p_getc(&flip,f,keepdata)) |
| 11150 | ✗ | return qe_invalid; | |
| 11151 | |||
| 11152 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(!p_getc(&extend,f,keepdata)) |
| 11153 | ✗ | return qe_invalid; | |
| 11154 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if (keepdata) |
| 11155 | { | ||
| 11156 | 8 | setSprite(sideswimcastingspr, int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11157 | 8 | } | |
| 11158 | |||
| 11159 | 8 | } | |
| 11160 | ✗ | else if (keepdata) | |
| 11161 | { | ||
| 11162 | ✗ | memset(sideswimcastingspr, 0, sizeof(sideswimcastingspr)); | |
| 11163 | } | ||
| 11164 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if (v_herosprites > 13) |
| 11165 | { | ||
| 11166 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 11167 | { | ||
| 11168 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 11169 | ✗ | return qe_invalid; | |
| 11170 | |||
| 11171 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 11172 | ✗ | return qe_invalid; | |
| 11173 | |||
| 11174 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 11175 | ✗ | return qe_invalid; | |
| 11176 | |||
| 11177 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 11178 | { | ||
| 11179 | 32 | setSprite(sidedrowningspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11180 | 32 | } | |
| 11181 | 32 | } | |
| 11182 | 8 | } | |
| 11183 | ✗ | else if (keepdata) | |
| 11184 | { | ||
| 11185 | ✗ | memset(sidedrowningspr, 0, sizeof(sidedrowningspr)); | |
| 11186 | } | ||
| 11187 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if (v_herosprites > 14) |
| 11188 | { | ||
| 11189 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
|
40 | for(int32_t q = 0; q < 4; ++q) |
| 11190 | { | ||
| 11191 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&tile,f,keepdata)) |
| 11192 | ✗ | return qe_invalid; | |
| 11193 | |||
| 11194 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&flip,f,keepdata)) |
| 11195 | ✗ | return qe_invalid; | |
| 11196 | |||
| 11197 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(!p_getc(&extend,f,keepdata)) |
| 11198 | ✗ | return qe_invalid; | |
| 11199 | |||
| 11200 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(keepdata) |
| 11201 | { | ||
| 11202 | 32 | setSprite(revslashspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11203 | 32 | } | |
| 11204 | 32 | } | |
| 11205 | 8 | } | |
| 11206 | ✗ | else if (keepdata) | |
| 11207 | { | ||
| 11208 | ✗ | memset(revslashspr, 0, sizeof(revslashspr)); | |
| 11209 | } | ||
| 11210 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if (v_herosprites > 7) |
| 11211 | { | ||
| 11212 | 8 | int32_t num_defense = wMax; | |
| 11213 | 8 | byte def = 0; | |
| 11214 | |||
| 11215 | //Set num_defense accordingly if changes to enum require version upgrade - Jman | ||
| 11216 | /*if(v_herosprites > [x]) | ||
| 11217 | * { | ||
| 11218 | * num_defense = 146 //value of wMax on version 8 | ||
| 11219 | * } | ||
| 11220 | */ | ||
| 11221 | |||
| 11222 |
2/2✓ Branch 0 taken 1168 times.
✓ Branch 1 taken 8 times.
|
1176 | for (int32_t q = 0; q < num_defense; q++) |
| 11223 | { | ||
| 11224 |
1/2✓ Branch 0 taken 1168 times.
✗ Branch 1 not taken.
|
1168 | if (!p_getc(&def, f, keepdata)) |
| 11225 | ✗ | return qe_invalid; | |
| 11226 | |||
| 11227 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1168 times.
|
1168 | if (keepdata) |
| 11228 | { | ||
| 11229 | 1168 | hero_defence[q] = def; | |
| 11230 | 1168 | } | |
| 11231 | 1168 | } | |
| 11232 | 8 | } | |
| 11233 | ✗ | else if (keepdata) | |
| 11234 | { | ||
| 11235 | ✗ | int32_t num_defense = wMax; | |
| 11236 | ✗ | for (int32_t q = 0; q < num_defense; q++) | |
| 11237 | { | ||
| 11238 | ✗ | hero_defence[q] = 0; | |
| 11239 | } | ||
| 11240 | } | ||
| 11241 | 8 | } | |
| 11242 | |||
| 11243 | 8 | return 0; | |
| 11244 | 8 | } | |
| 11245 | |||
| 11246 | |||
| 11247 | 77 | int32_t readherosprites(PACKFILE *f, zquestheader *Header, bool keepdata) | |
| 11248 | { | ||
| 11249 | //these are here to bypass compiler warnings about unused arguments | ||
| 11250 | 77 | Header=Header; | |
| 11251 | |||
| 11252 | dword dummy; | ||
| 11253 | 77 | word s_version=0, s_cversion=0; | |
| 11254 | |||
| 11255 | //section version info | ||
| 11256 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(!p_igetw(&s_version,f,true)) |
| 11257 | { | ||
| 11258 | ✗ | return qe_invalid; | |
| 11259 | } | ||
| 11260 | |||
| 11261 | 77 | FFCore.quest_format[vHeroSprites] = s_version; | |
| 11262 | |||
| 11263 | //al_trace("Player sprites version %d\n", s_version); | ||
| 11264 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_cversion,f,true)) |
| 11265 | { | ||
| 11266 | ✗ | return qe_invalid; | |
| 11267 | } | ||
| 11268 | |||
| 11269 | //section size | ||
| 11270 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&dummy,f,true)) |
| 11271 | { | ||
| 11272 | ✗ | return qe_invalid; | |
| 11273 | } | ||
| 11274 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if ( s_version >= 6 ) |
| 11275 | { | ||
| 11276 | //al_trace("Reading Player Sprites v6\n"); | ||
| 11277 | 8 | return readherosprites3(f, s_version, dummy, keepdata); | |
| 11278 | } | ||
| 11279 | 69 | else return readherosprites2(f, s_version, dummy, keepdata); | |
| 11280 | 77 | } | |
| 11281 | |||
| 11282 | 77 | int32_t readsubscreens(PACKFILE *f, zquestheader *Header, bool keepdata) | |
| 11283 | { | ||
| 11284 | int32_t dummy; | ||
| 11285 | 77 | word s_version=0, s_cversion=0; | |
| 11286 | |||
| 11287 | //section version info | ||
| 11288 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(!p_igetw(&s_version,f,true)) |
| 11289 | { | ||
| 11290 | ✗ | return qe_invalid; | |
| 11291 | } | ||
| 11292 | |||
| 11293 | 77 | FFCore.quest_format[vSubscreen] = s_version; | |
| 11294 | |||
| 11295 | //al_trace("Subscreens version %d\n", s_version); | ||
| 11296 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_cversion,f,true)) |
| 11297 | { | ||
| 11298 | ✗ | return qe_invalid; | |
| 11299 | } | ||
| 11300 | |||
| 11301 | //section size | ||
| 11302 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&dummy,f,true)) |
| 11303 | { | ||
| 11304 | ✗ | return qe_invalid; | |
| 11305 | } | ||
| 11306 | |||
| 11307 | //finally... section data | ||
| 11308 |
2/2✓ Branch 0 taken 9856 times.
✓ Branch 1 taken 77 times.
|
9933 | for(int32_t i=0; i<MAXCUSTOMSUBSCREENS; i++) |
| 11309 | { | ||
| 11310 | 9856 | int32_t ret = read_one_subscreen(f, Header, keepdata, i, s_version, s_cversion); | |
| 11311 | |||
| 11312 |
1/2✓ Branch 0 taken 9856 times.
✗ Branch 1 not taken.
|
9856 | if(ret!=0) return ret; |
| 11313 | 9856 | } | |
| 11314 | |||
| 11315 | 77 | return 0; | |
| 11316 | 77 | } | |
| 11317 | |||
| 11318 | 9856 | int32_t read_one_subscreen(PACKFILE *f, zquestheader *, bool keepdata, int32_t i, word s_version, word) | |
| 11319 | { | ||
| 11320 | 9856 | int32_t numsub=0; | |
| 11321 | 9856 | byte temp_ss=0; | |
| 11322 | subscreen_object temp_sub_stack; | ||
| 11323 | 9856 | subscreen_object *temp_sub = &temp_sub_stack; | |
| 11324 | |||
| 11325 | char tempname[64]; | ||
| 11326 | |||
| 11327 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9856 times.
|
9856 | if(!pfread(tempname,64,f,true)) |
| 11328 | { | ||
| 11329 | ✗ | return qe_invalid; | |
| 11330 | } | ||
| 11331 | |||
| 11332 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9856 times.
|
9856 | if(s_version > 1) |
| 11333 | { | ||
| 11334 |
1/2✓ Branch 0 taken 9856 times.
✗ Branch 1 not taken.
|
9856 | if(!p_getc(&temp_ss,f,keepdata)) |
| 11335 | { | ||
| 11336 | ✗ | return qe_invalid; | |
| 11337 | } | ||
| 11338 | 9856 | } | |
| 11339 | |||
| 11340 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9856 times.
|
9856 | if(s_version < 4) |
| 11341 | { | ||
| 11342 | ✗ | uint8_t tmp=0; | |
| 11343 | |||
| 11344 | ✗ | if(!p_getc(&tmp,f,true)) | |
| 11345 | { | ||
| 11346 | ✗ | return qe_invalid; | |
| 11347 | } | ||
| 11348 | |||
| 11349 | ✗ | numsub = (int32_t)tmp; | |
| 11350 | } | ||
| 11351 | else | ||
| 11352 | { | ||
| 11353 | word tmp; | ||
| 11354 | |||
| 11355 |
1/2✓ Branch 0 taken 9856 times.
✗ Branch 1 not taken.
|
9856 | if(!p_igetw(&tmp, f, true)) |
| 11356 | { | ||
| 11357 | ✗ | return qe_invalid; | |
| 11358 | } | ||
| 11359 | |||
| 11360 | 9856 | numsub = (int32_t)tmp; | |
| 11361 | } | ||
| 11362 | |||
| 11363 | int32_t j; | ||
| 11364 | |||
| 11365 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 20484 times.
✓ Branch 2 taken 10628 times.
✓ Branch 3 taken 9856 times.
|
20484 | for(j=0; (j<MAXSUBSCREENITEMS&&j<numsub); j++) |
| 11366 | { | ||
| 11367 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10628 times.
|
10628 | if(keepdata) |
| 11368 | { | ||
| 11369 | 10628 | memset(temp_sub,0,sizeof(subscreen_object)); | |
| 11370 | |||
| 11371 |
2/2✓ Branch 0 taken 1040 times.
✓ Branch 1 taken 9588 times.
|
10628 | switch(custom_subscreen[i].objects[j].type) |
| 11372 | { | ||
| 11373 | case ssoTEXT: | ||
| 11374 | case ssoTEXTBOX: | ||
| 11375 | case ssoCURRENTITEMTEXT: | ||
| 11376 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11377 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 1040 times.
✓ Branch 2 taken 1040 times.
✗ Branch 3 not taken.
|
1040 | if(custom_subscreen[i].objects[j].dp1 != NULL) delete [](char *)custom_subscreen[i].objects[j].dp1; |
| 11378 | |||
| 11379 | //fall through | ||
| 11380 | default: | ||
| 11381 | 10628 | memset(&custom_subscreen[i].objects[j],0,sizeof(subscreen_object)); | |
| 11382 | 10628 | break; | |
| 11383 | } | ||
| 11384 | 10628 | } | |
| 11385 | |||
| 11386 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_getc(&(temp_sub->type),f,true)) |
| 11387 | { | ||
| 11388 | ✗ | return qe_invalid; | |
| 11389 | } | ||
| 11390 | |||
| 11391 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_getc(&(temp_sub->pos),f,keepdata)) |
| 11392 | { | ||
| 11393 | ✗ | return qe_invalid; | |
| 11394 | } | ||
| 11395 | |||
| 11396 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(s_version < 5) |
| 11397 | { | ||
| 11398 | ✗ | switch(temp_sub->pos) | |
| 11399 | { | ||
| 11400 | case 0: | ||
| 11401 | ✗ | temp_sub->pos = sspUP | sspDOWN | sspSCROLLING; | |
| 11402 | ✗ | break; | |
| 11403 | |||
| 11404 | case 1: | ||
| 11405 | ✗ | temp_sub->pos = sspUP; | |
| 11406 | ✗ | break; | |
| 11407 | |||
| 11408 | case 2: | ||
| 11409 | ✗ | temp_sub->pos = sspDOWN; | |
| 11410 | ✗ | break; | |
| 11411 | |||
| 11412 | default: | ||
| 11413 | ✗ | temp_sub->pos = 0; | |
| 11414 | } | ||
| 11415 | } | ||
| 11416 | |||
| 11417 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_igetw(&(temp_sub->x),f,keepdata)) |
| 11418 | { | ||
| 11419 | ✗ | return qe_invalid; | |
| 11420 | } | ||
| 11421 | |||
| 11422 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_igetw(&(temp_sub->y),f,keepdata)) |
| 11423 | { | ||
| 11424 | ✗ | return qe_invalid; | |
| 11425 | } | ||
| 11426 | |||
| 11427 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_igetw(&(temp_sub->w),f,keepdata)) |
| 11428 | { | ||
| 11429 | ✗ | return qe_invalid; | |
| 11430 | } | ||
| 11431 | |||
| 11432 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_igetw(&(temp_sub->h),f,keepdata)) |
| 11433 | { | ||
| 11434 | ✗ | return qe_invalid; | |
| 11435 | } | ||
| 11436 | |||
| 11437 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_getc(&(temp_sub->colortype1),f,keepdata)) |
| 11438 | { | ||
| 11439 | ✗ | return qe_invalid; | |
| 11440 | } | ||
| 11441 | |||
| 11442 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_igetw(&(temp_sub->color1),f,keepdata)) |
| 11443 | { | ||
| 11444 | ✗ | return qe_invalid; | |
| 11445 | } | ||
| 11446 | |||
| 11447 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_getc(&(temp_sub->colortype2),f,keepdata)) |
| 11448 | { | ||
| 11449 | ✗ | return qe_invalid; | |
| 11450 | } | ||
| 11451 | |||
| 11452 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_igetw(&(temp_sub->color2),f,keepdata)) |
| 11453 | { | ||
| 11454 | ✗ | return qe_invalid; | |
| 11455 | } | ||
| 11456 | |||
| 11457 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_getc(&(temp_sub->colortype3),f,keepdata)) |
| 11458 | { | ||
| 11459 | ✗ | return qe_invalid; | |
| 11460 | } | ||
| 11461 | |||
| 11462 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_igetw(&(temp_sub->color3),f,keepdata)) |
| 11463 | { | ||
| 11464 | ✗ | return qe_invalid; | |
| 11465 | } | ||
| 11466 | |||
| 11467 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_igetd(&(temp_sub->d1),f,keepdata)) |
| 11468 | { | ||
| 11469 | ✗ | return qe_invalid; | |
| 11470 | } | ||
| 11471 | |||
| 11472 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_igetd(&(temp_sub->d2),f,keepdata)) |
| 11473 | { | ||
| 11474 | ✗ | return qe_invalid; | |
| 11475 | } | ||
| 11476 | |||
| 11477 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_igetd(&(temp_sub->d3),f,keepdata)) |
| 11478 | { | ||
| 11479 | ✗ | return qe_invalid; | |
| 11480 | } | ||
| 11481 | |||
| 11482 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_igetd(&(temp_sub->d4),f,keepdata)) |
| 11483 | { | ||
| 11484 | ✗ | return qe_invalid; | |
| 11485 | } | ||
| 11486 | |||
| 11487 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_igetd(&(temp_sub->d5),f,keepdata)) |
| 11488 | { | ||
| 11489 | ✗ | return qe_invalid; | |
| 11490 | } | ||
| 11491 | |||
| 11492 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_igetd(&(temp_sub->d6),f,keepdata)) |
| 11493 | { | ||
| 11494 | ✗ | return qe_invalid; | |
| 11495 | } | ||
| 11496 | |||
| 11497 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_igetd(&(temp_sub->d7),f,keepdata)) |
| 11498 | { | ||
| 11499 | ✗ | return qe_invalid; | |
| 11500 | } | ||
| 11501 | |||
| 11502 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_igetd(&(temp_sub->d8),f,keepdata)) |
| 11503 | { | ||
| 11504 | ✗ | return qe_invalid; | |
| 11505 | } | ||
| 11506 | |||
| 11507 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_igetd(&(temp_sub->d9),f,keepdata)) |
| 11508 | { | ||
| 11509 | ✗ | return qe_invalid; | |
| 11510 | } | ||
| 11511 | |||
| 11512 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_igetd(&(temp_sub->d10),f,keepdata)) |
| 11513 | { | ||
| 11514 | ✗ | return qe_invalid; | |
| 11515 | } | ||
| 11516 | |||
| 11517 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10628 times.
|
10628 | if(s_version < 2) |
| 11518 | { | ||
| 11519 | ✗ | if(!p_igetl(&(temp_sub->speed),f,keepdata)) | |
| 11520 | { | ||
| 11521 | ✗ | return qe_invalid; | |
| 11522 | } | ||
| 11523 | |||
| 11524 | ✗ | if(!p_igetl(&(temp_sub->delay),f,keepdata)) | |
| 11525 | { | ||
| 11526 | ✗ | return qe_invalid; | |
| 11527 | } | ||
| 11528 | |||
| 11529 | ✗ | if(!p_igetl(&(temp_sub->frame),f,keepdata)) | |
| 11530 | { | ||
| 11531 | ✗ | return qe_invalid; | |
| 11532 | } | ||
| 11533 | } | ||
| 11534 | else | ||
| 11535 | { | ||
| 11536 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_getc(&(temp_sub->speed),f,keepdata)) |
| 11537 | { | ||
| 11538 | ✗ | return qe_invalid; | |
| 11539 | } | ||
| 11540 | |||
| 11541 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_getc(&(temp_sub->delay),f,keepdata)) |
| 11542 | { | ||
| 11543 | ✗ | return qe_invalid; | |
| 11544 | } | ||
| 11545 | |||
| 11546 |
1/2✓ Branch 0 taken 10628 times.
✗ Branch 1 not taken.
|
10628 | if(!p_igetw(&(temp_sub->frame),f,keepdata)) |
| 11547 | { | ||
| 11548 | ✗ | return qe_invalid; | |
| 11549 | } | ||
| 11550 | } | ||
| 11551 | |||
| 11552 | 10628 | int32_t temp_size=0; | |
| 11553 | |||
| 11554 | // bool deletets = false; | ||
| 11555 |
4/4✓ Branch 0 taken 4707 times.
✓ Branch 1 taken 1219 times.
✓ Branch 2 taken 4564 times.
✓ Branch 3 taken 138 times.
|
10628 | switch(temp_sub->type) |
| 11556 | { | ||
| 11557 | case ssoTEXT: | ||
| 11558 | case ssoTEXTBOX: | ||
| 11559 | case ssoCURRENTITEMTEXT: | ||
| 11560 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11561 | word temptempsize; | ||
| 11562 | /*uint8_t temp1; | ||
| 11563 | uint8_t temp2; | ||
| 11564 | temp2 = 0; | ||
| 11565 | if(!p_getc(&temp1,f,true)) | ||
| 11566 | { | ||
| 11567 | return qe_invalid; | ||
| 11568 | } | ||
| 11569 | if(temp1) | ||
| 11570 | { | ||
| 11571 | |||
| 11572 | if(!p_getc(&temp2,f,true)) | ||
| 11573 | { | ||
| 11574 | return qe_invalid; | ||
| 11575 | } | ||
| 11576 | }*/ | ||
| 11577 | |||
| 11578 |
1/2✓ Branch 0 taken 1219 times.
✗ Branch 1 not taken.
|
1219 | if(!p_igetw(&temptempsize,f,true)) |
| 11579 | { | ||
| 11580 | ✗ | return qe_invalid; | |
| 11581 | } | ||
| 11582 | |||
| 11583 | //temptempsize = temp1 + (temp2 << 8); | ||
| 11584 | 1219 | temp_size = (int32_t)temptempsize; | |
| 11585 | |||
| 11586 | //if(temp_sub->dp1!=NULL) delete[] temp_sub->dp1; | ||
| 11587 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1219 times.
|
1219 | if(keepdata) |
| 11588 | { | ||
| 11589 | 1219 | uint32_t char_length = temp_size+1; | |
| 11590 | 1219 | temp_sub->dp1 = new char[char_length]; //memory not freed | |
| 11591 | |||
| 11592 | //deletets = true; //obsolete | ||
| 11593 | 1219 | } | |
| 11594 | |||
| 11595 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1219 times.
|
1219 | if(temp_size) |
| 11596 | { | ||
| 11597 |
1/2✓ Branch 0 taken 1219 times.
✗ Branch 1 not taken.
|
1219 | if(!pfread(temp_sub->dp1,temp_size+1,f,keepdata)) |
| 11598 | { | ||
| 11599 | ✗ | return qe_invalid; | |
| 11600 | } | ||
| 11601 | 1219 | } | |
| 11602 | |||
| 11603 | 1219 | break; | |
| 11604 | |||
| 11605 | case ssoLIFEMETER: | ||
| 11606 |
1/2✓ Branch 0 taken 138 times.
✗ Branch 1 not taken.
|
138 | if(get_bit(deprecated_rules, 12) != 0) // qr_24HC |
| 11607 | ✗ | temp_sub->d3 = 1; | |
| 11608 | |||
| 11609 |
1/2✓ Branch 0 taken 138 times.
✗ Branch 1 not taken.
|
138 | if(!p_getc(&(temp_sub->dp1),f,keepdata)) |
| 11610 | { | ||
| 11611 | ✗ | return qe_invalid; | |
| 11612 | } | ||
| 11613 | |||
| 11614 | 138 | break; | |
| 11615 | |||
| 11616 | |||
| 11617 | case ssoCURRENTITEM: | ||
| 11618 | |||
| 11619 |
1/2✓ Branch 0 taken 4707 times.
✗ Branch 1 not taken.
|
4707 | if(s_version < 6) |
| 11620 | { | ||
| 11621 | ✗ | switch(temp_sub->d1) | |
| 11622 | { | ||
| 11623 | case ssiBOMB: | ||
| 11624 | ✗ | temp_sub->d1 = itype_bomb; | |
| 11625 | ✗ | break; | |
| 11626 | |||
| 11627 | case ssiSWORD: | ||
| 11628 | ✗ | temp_sub->d1 = itype_sword; | |
| 11629 | ✗ | break; | |
| 11630 | |||
| 11631 | case ssiSHIELD: | ||
| 11632 | ✗ | temp_sub->d1 = itype_shield; | |
| 11633 | ✗ | break; | |
| 11634 | |||
| 11635 | case ssiCANDLE: | ||
| 11636 | ✗ | temp_sub->d1 = itype_candle; | |
| 11637 | ✗ | break; | |
| 11638 | |||
| 11639 | case ssiLETTER: | ||
| 11640 | ✗ | temp_sub->d1 = itype_letter; | |
| 11641 | ✗ | break; | |
| 11642 | |||
| 11643 | case ssiPOTION: | ||
| 11644 | ✗ | temp_sub->d1 = itype_potion; | |
| 11645 | ✗ | break; | |
| 11646 | |||
| 11647 | case ssiLETTERPOTION: | ||
| 11648 | ✗ | temp_sub->d1 = itype_letterpotion; | |
| 11649 | ✗ | break; | |
| 11650 | |||
| 11651 | case ssiBOW: | ||
| 11652 | ✗ | temp_sub->d1 = itype_bow; | |
| 11653 | ✗ | break; | |
| 11654 | |||
| 11655 | case ssiARROW: | ||
| 11656 | ✗ | temp_sub->d1 = itype_arrow; | |
| 11657 | ✗ | break; | |
| 11658 | |||
| 11659 | case ssiBOWANDARROW: | ||
| 11660 | ✗ | temp_sub->d1 = itype_bowandarrow; | |
| 11661 | ✗ | break; | |
| 11662 | |||
| 11663 | case ssiBAIT: | ||
| 11664 | ✗ | temp_sub->d1 = itype_bait; | |
| 11665 | ✗ | break; | |
| 11666 | |||
| 11667 | case ssiRING: | ||
| 11668 | ✗ | temp_sub->d1 = itype_ring; | |
| 11669 | ✗ | break; | |
| 11670 | |||
| 11671 | case ssiBRACELET: | ||
| 11672 | ✗ | temp_sub->d1 = itype_bracelet; | |
| 11673 | ✗ | break; | |
| 11674 | |||
| 11675 | case ssiMAP: | ||
| 11676 | ✗ | temp_sub->d1 = itype_map; | |
| 11677 | ✗ | break; | |
| 11678 | |||
| 11679 | case ssiCOMPASS: | ||
| 11680 | ✗ | temp_sub->d1 = itype_compass; | |
| 11681 | ✗ | break; | |
| 11682 | |||
| 11683 | case ssiBOSSKEY: | ||
| 11684 | ✗ | temp_sub->d1 = itype_bosskey; | |
| 11685 | ✗ | break; | |
| 11686 | |||
| 11687 | case ssiMAGICKEY: | ||
| 11688 | ✗ | temp_sub->d1 = itype_magickey; | |
| 11689 | ✗ | break; | |
| 11690 | |||
| 11691 | case ssiBRANG: | ||
| 11692 | ✗ | temp_sub->d1 = itype_brang; | |
| 11693 | ✗ | break; | |
| 11694 | |||
| 11695 | case ssiWAND: | ||
| 11696 | ✗ | temp_sub->d1 = itype_wand; | |
| 11697 | ✗ | break; | |
| 11698 | |||
| 11699 | case ssiRAFT: | ||
| 11700 | ✗ | temp_sub->d1 = itype_raft; | |
| 11701 | ✗ | break; | |
| 11702 | |||
| 11703 | case ssiLADDER: | ||
| 11704 | ✗ | temp_sub->d1 = itype_ladder; | |
| 11705 | ✗ | break; | |
| 11706 | |||
| 11707 | case ssiWHISTLE: | ||
| 11708 | ✗ | temp_sub->d1 = itype_whistle; | |
| 11709 | ✗ | break; | |
| 11710 | |||
| 11711 | case ssiBOOK: | ||
| 11712 | ✗ | temp_sub->d1 = itype_book; | |
| 11713 | ✗ | break; | |
| 11714 | |||
| 11715 | case ssiWALLET: | ||
| 11716 | ✗ | temp_sub->d1 = itype_wallet; | |
| 11717 | ✗ | break; | |
| 11718 | |||
| 11719 | case ssiSBOMB: | ||
| 11720 | ✗ | temp_sub->d1 = itype_sbomb; | |
| 11721 | ✗ | break; | |
| 11722 | |||
| 11723 | case ssiHCPIECE: | ||
| 11724 | ✗ | temp_sub->d1 = itype_heartpiece; | |
| 11725 | ✗ | break; | |
| 11726 | |||
| 11727 | case ssiAMULET: | ||
| 11728 | ✗ | temp_sub->d1 = itype_amulet; | |
| 11729 | ✗ | break; | |
| 11730 | |||
| 11731 | case ssiFLIPPERS: | ||
| 11732 | ✗ | temp_sub->d1 = itype_flippers; | |
| 11733 | ✗ | break; | |
| 11734 | |||
| 11735 | case ssiHOOKSHOT: | ||
| 11736 | ✗ | temp_sub->d1 = itype_hookshot; | |
| 11737 | ✗ | break; | |
| 11738 | |||
| 11739 | case ssiLENS: | ||
| 11740 | ✗ | temp_sub->d1 = itype_lens; | |
| 11741 | ✗ | break; | |
| 11742 | |||
| 11743 | case ssiHAMMER: | ||
| 11744 | ✗ | temp_sub->d1 = itype_hammer; | |
| 11745 | ✗ | break; | |
| 11746 | |||
| 11747 | case ssiBOOTS: | ||
| 11748 | ✗ | temp_sub->d1 = itype_boots; | |
| 11749 | ✗ | break; | |
| 11750 | |||
| 11751 | case ssiDINSFIRE: | ||
| 11752 | ✗ | temp_sub->d1 = itype_dinsfire; | |
| 11753 | ✗ | break; | |
| 11754 | |||
| 11755 | case ssiFARORESWIND: | ||
| 11756 | ✗ | temp_sub->d1 = itype_faroreswind; | |
| 11757 | ✗ | break; | |
| 11758 | |||
| 11759 | case ssiNAYRUSLOVE: | ||
| 11760 | ✗ | temp_sub->d1 = itype_nayruslove; | |
| 11761 | ✗ | break; | |
| 11762 | |||
| 11763 | case ssiQUIVER: | ||
| 11764 | ✗ | temp_sub->d1 = itype_quiver; | |
| 11765 | ✗ | break; | |
| 11766 | |||
| 11767 | case ssiBOMBBAG: | ||
| 11768 | ✗ | temp_sub->d1 = itype_bombbag; | |
| 11769 | ✗ | break; | |
| 11770 | |||
| 11771 | case ssiCBYRNA: | ||
| 11772 | ✗ | temp_sub->d1 = itype_cbyrna; | |
| 11773 | ✗ | break; | |
| 11774 | |||
| 11775 | case ssiROCS: | ||
| 11776 | ✗ | temp_sub->d1 = itype_rocs; | |
| 11777 | ✗ | break; | |
| 11778 | |||
| 11779 | case ssiHOVERBOOTS: | ||
| 11780 | ✗ | temp_sub->d1 = itype_hoverboots; | |
| 11781 | ✗ | break; | |
| 11782 | |||
| 11783 | case ssiSPINSCROLL: | ||
| 11784 | ✗ | temp_sub->d1 = itype_spinscroll; | |
| 11785 | ✗ | break; | |
| 11786 | |||
| 11787 | case ssiCROSSSCROLL: | ||
| 11788 | ✗ | temp_sub->d1 = itype_crossscroll; | |
| 11789 | ✗ | break; | |
| 11790 | |||
| 11791 | case ssiQUAKESCROLL: | ||
| 11792 | ✗ | temp_sub->d1 = itype_quakescroll; | |
| 11793 | ✗ | break; | |
| 11794 | |||
| 11795 | case ssiWHISPRING: | ||
| 11796 | ✗ | temp_sub->d1 = itype_whispring; | |
| 11797 | ✗ | break; | |
| 11798 | |||
| 11799 | case ssiCHARGERING: | ||
| 11800 | ✗ | temp_sub->d1 = itype_chargering; | |
| 11801 | ✗ | break; | |
| 11802 | |||
| 11803 | case ssiPERILSCROLL: | ||
| 11804 | ✗ | temp_sub->d1 = itype_perilscroll; | |
| 11805 | ✗ | break; | |
| 11806 | |||
| 11807 | case ssiWEALTHMEDAL: | ||
| 11808 | ✗ | temp_sub->d1 = itype_wealthmedal; | |
| 11809 | ✗ | break; | |
| 11810 | |||
| 11811 | case ssiHEARTRING: | ||
| 11812 | ✗ | temp_sub->d1 = itype_heartring; | |
| 11813 | ✗ | break; | |
| 11814 | |||
| 11815 | case ssiMAGICRING: | ||
| 11816 | ✗ | temp_sub->d1 = itype_magicring; | |
| 11817 | ✗ | break; | |
| 11818 | |||
| 11819 | case ssiSPINSCROLL2: | ||
| 11820 | ✗ | temp_sub->d1 = itype_spinscroll2; | |
| 11821 | ✗ | break; | |
| 11822 | |||
| 11823 | case ssiQUAKESCROLL2: | ||
| 11824 | ✗ | temp_sub->d1 = itype_quakescroll2; | |
| 11825 | ✗ | break; | |
| 11826 | |||
| 11827 | case ssiAGONY: | ||
| 11828 | ✗ | temp_sub->d1 = itype_agony; | |
| 11829 | ✗ | break; | |
| 11830 | |||
| 11831 | case ssiSTOMPBOOTS: | ||
| 11832 | ✗ | temp_sub->d1 = itype_stompboots; | |
| 11833 | ✗ | break; | |
| 11834 | |||
| 11835 | case ssiWHIMSICALRING: | ||
| 11836 | ✗ | temp_sub->d1 = itype_whimsicalring; | |
| 11837 | ✗ | break; | |
| 11838 | |||
| 11839 | case ssiPERILRING: | ||
| 11840 | ✗ | temp_sub->d1 = itype_perilring; | |
| 11841 | ✗ | break; | |
| 11842 | |||
| 11843 | default: | ||
| 11844 | ✗ | temp_sub->d1 += itype_custom1 - ssiMAX; | |
| 11845 | } | ||
| 11846 | } | ||
| 11847 | |||
| 11848 | //fall-through | ||
| 11849 | default: | ||
| 11850 |
1/2✓ Branch 0 taken 9271 times.
✗ Branch 1 not taken.
|
9271 | if(!p_getc(&(temp_sub->dp1),f,keepdata)) |
| 11851 | { | ||
| 11852 | ✗ | return qe_invalid; | |
| 11853 | } | ||
| 11854 | |||
| 11855 | 9271 | break; | |
| 11856 | } | ||
| 11857 | |||
| 11858 |
2/2✓ Branch 0 taken 3978 times.
✓ Branch 1 taken 6650 times.
|
10628 | if(s_version < 7) |
| 11859 | { | ||
| 11860 |
1/3✓ Branch 0 taken 6650 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
6650 | switch(temp_sub->type) |
| 11861 | { | ||
| 11862 | case ssoMAGICGAUGE: | ||
| 11863 | { | ||
| 11864 | ✗ | if(!temp_sub->d9) | |
| 11865 | ✗ | temp_sub->d9 = -1; //-1 now represents 'always' | |
| 11866 | ✗ | break; | |
| 11867 | } | ||
| 11868 | case ssoLIFEGAUGE: | ||
| 11869 | ✗ | temp_sub->d9 = 0; //Unused, doesn't do anything? Clear it... | |
| 11870 | ✗ | break; | |
| 11871 | } | ||
| 11872 | 6650 | } | |
| 11873 | |||
| 11874 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10628 times.
|
10628 | if(keepdata) |
| 11875 | { | ||
| 11876 |
3/3✓ Branch 0 taken 1219 times.
✓ Branch 1 taken 9054 times.
✓ Branch 2 taken 355 times.
|
10628 | switch(temp_sub->type) |
| 11877 | { | ||
| 11878 | case ssoTEXT: | ||
| 11879 | case ssoTEXTBOX: | ||
| 11880 | case ssoCURRENTITEMTEXT: | ||
| 11881 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11882 |
1/4✓ Branch 0 taken 1219 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1219 | if(custom_subscreen[i].objects[j].dp1 != NULL) delete[](char *)custom_subscreen[i].objects[j].dp1; |
| 11883 | |||
| 11884 | 1219 | memcpy(&custom_subscreen[i].objects[j],temp_sub,sizeof(subscreen_object)); | |
| 11885 | 1219 | custom_subscreen[i].objects[j].dp1 = NULL; | |
| 11886 | 1219 | custom_subscreen[i].objects[j].dp1 = new char[temp_size+1]; | |
| 11887 | 1219 | strcpy((char*)custom_subscreen[i].objects[j].dp1,(char*)temp_sub->dp1); | |
| 11888 | 1219 | break; | |
| 11889 | |||
| 11890 | case ssoCOUNTER: | ||
| 11891 |
1/2✓ Branch 0 taken 355 times.
✗ Branch 1 not taken.
|
355 | if(s_version<3) |
| 11892 | { | ||
| 11893 | ✗ | temp_sub->d6=(temp_sub->d6?1:0)+(temp_sub->d8?2:0); | |
| 11894 | ✗ | temp_sub->d8=0; | |
| 11895 | } | ||
| 11896 | |||
| 11897 | default: | ||
| 11898 | 9409 | memcpy(&custom_subscreen[i].objects[j],temp_sub,sizeof(subscreen_object)); | |
| 11899 | 9409 | break; | |
| 11900 | } | ||
| 11901 | |||
| 11902 | 10628 | strcpy(custom_subscreen[i].name, tempname); | |
| 11903 | 10628 | custom_subscreen[i].ss_type = temp_ss; | |
| 11904 | 10628 | } | |
| 11905 | 10628 | } | |
| 11906 | |||
| 11907 |
2/2✓ Branch 0 taken 2512508 times.
✓ Branch 1 taken 9856 times.
|
2522364 | for(j=numsub; j<MAXSUBSCREENITEMS; j++) |
| 11908 | { | ||
| 11909 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2512508 times.
|
2512508 | if(keepdata) |
| 11910 | { | ||
| 11911 | //clear all unused object in this subscreen -DD | ||
| 11912 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2512508 times.
|
2512508 | switch(custom_subscreen[i].objects[j].type) |
| 11913 | { | ||
| 11914 | case ssoTEXT: | ||
| 11915 | case ssoTEXTBOX: | ||
| 11916 | case ssoCURRENTITEMTEXT: | ||
| 11917 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11918 | ✗ | if(custom_subscreen[i].objects[j].dp1 != NULL) delete [](char *)custom_subscreen[i].objects[j].dp1; | |
| 11919 | |||
| 11920 | //fall through | ||
| 11921 | default: | ||
| 11922 | 2512508 | memset(&custom_subscreen[i].objects[j],0,sizeof(subscreen_object)); | |
| 11923 | 2512508 | break; | |
| 11924 | } | ||
| 11925 | 2512508 | } | |
| 11926 | 2512508 | } | |
| 11927 | |||
| 11928 | 9856 | return 0; | |
| 11929 | 9856 | } | |
| 11930 | |||
| 11931 | 1664 | void reset_subscreen(subscreen_group *tempss) | |
| 11932 | { | ||
| 11933 |
2/2✓ Branch 0 taken 425984 times.
✓ Branch 1 taken 1664 times.
|
427648 | for(int32_t i=0; i<MAXSUBSCREENITEMS; ++i) |
| 11934 | { | ||
| 11935 |
2/2✓ Branch 0 taken 89 times.
✓ Branch 1 taken 425895 times.
|
425984 | switch(tempss->objects[i].type) |
| 11936 | { | ||
| 11937 | case ssoTEXT: | ||
| 11938 | case ssoTEXTBOX: | ||
| 11939 | case ssoCURRENTITEMTEXT: | ||
| 11940 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11941 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 89 times.
✓ Branch 2 taken 89 times.
✗ Branch 3 not taken.
|
89 | if(tempss->objects[i].dp1 != NULL) delete [](char *)tempss->objects[i].dp1; |
| 11942 | |||
| 11943 | //fall through | ||
| 11944 | default: | ||
| 11945 | 425984 | memset(&tempss->objects[i],0,sizeof(subscreen_object)); | |
| 11946 | 425984 | break; | |
| 11947 | } | ||
| 11948 | 425984 | } | |
| 11949 | 1664 | } | |
| 11950 | |||
| 11951 | 13 | void reset_subscreens() | |
| 11952 | { | ||
| 11953 |
2/2✓ Branch 0 taken 1664 times.
✓ Branch 1 taken 13 times.
|
1677 | for(int32_t i=0; i<MAXCUSTOMSUBSCREENS; ++i) |
| 11954 | { | ||
| 11955 | 1664 | reset_subscreen(&custom_subscreen[i]); | |
| 11956 | 1664 | } | |
| 11957 | 13 | } | |
| 11958 | |||
| 11959 | 13 | int32_t setupsubscreens() | |
| 11960 | { | ||
| 11961 | 13 | reset_subscreens(); | |
| 11962 | 13 | int32_t tempsubscreen=zinit.subscreen; | |
| 11963 | subscreen_object *tempsub; | ||
| 11964 | |||
| 11965 |
1/2✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
|
13 | if(tempsubscreen>=ssdtMAX) |
| 11966 | { | ||
| 11967 | ✗ | tempsubscreen=0; | |
| 11968 | } | ||
| 11969 | |||
| 11970 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
|
13 | switch(tempsubscreen) |
| 11971 | { | ||
| 11972 | case ssdtOLD: | ||
| 11973 | case ssdtNEWSUBSCR: | ||
| 11974 | case ssdtREV2: | ||
| 11975 | case ssdtBSZELDA: | ||
| 11976 | case ssdtBSZELDAMODIFIED: | ||
| 11977 | case ssdtBSZELDAENHANCED: | ||
| 11978 | case ssdtBSZELDACOMPLETE: | ||
| 11979 | { | ||
| 11980 | 13 | tempsub = default_subscreen_active[tempsubscreen][0]; | |
| 11981 | int32_t i; | ||
| 11982 | |||
| 11983 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 858 times.
✓ Branch 2 taken 845 times.
✓ Branch 3 taken 13 times.
|
858 | for(i=0; (i<MAXSUBSCREENITEMS&&tempsub[i].type!=ssoNULL); i++) |
| 11984 | { | ||
| 11985 |
2/3✓ Branch 0 taken 42 times.
✓ Branch 1 taken 803 times.
✗ Branch 2 not taken.
|
845 | switch(tempsub[i].type) |
| 11986 | { | ||
| 11987 | case ssoTEXT: | ||
| 11988 | case ssoTEXTBOX: | ||
| 11989 | case ssoCURRENTITEMTEXT: | ||
| 11990 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11991 |
1/4✓ Branch 0 taken 42 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
42 | if(custom_subscreen[0].objects[i].dp1 != NULL) delete [](char *)custom_subscreen[0].objects[i].dp1; |
| 11992 | |||
| 11993 | 42 | memcpy(&custom_subscreen[0].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 11994 | 42 | custom_subscreen[0].objects[i].dp1 = NULL; | |
| 11995 | 42 | custom_subscreen[0].objects[i].dp1 = new char[strlen((char*)tempsub[i].dp1)+1]; | |
| 11996 | 42 | strcpy((char*)custom_subscreen[0].objects[i].dp1,(char*)tempsub[i].dp1); | |
| 11997 | 42 | break; | |
| 11998 | |||
| 11999 | case ssoLIFEMETER: | ||
| 12000 | { | ||
| 12001 | ✗ | memcpy(&custom_subscreen[0].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12002 | |||
| 12003 | ✗ | if(get_bit(deprecated_rules, 12) != 0) | |
| 12004 | ✗ | custom_subscreen[0].objects[i].d3=1; | |
| 12005 | else | ||
| 12006 | ✗ | custom_subscreen[0].objects[i].d3=0; | |
| 12007 | |||
| 12008 | ✗ | break; | |
| 12009 | } | ||
| 12010 | /* | ||
| 12011 | case ssoTRIFRAME: | ||
| 12012 | { | ||
| 12013 | memcpy(&custom_subscreen[0].objects[i],&tempsub[i],sizeof(subscreen_object)); | ||
| 12014 | custom_subscreen[0].objects[i].d1 = 8594; | ||
| 12015 | custom_subscreen[0].objects[i].d2 = 8; | ||
| 12016 | custom_subscreen[0].objects[i].d3 = 8771; | ||
| 12017 | custom_subscreen[0].objects[i].d4 = 8; | ||
| 12018 | custom_subscreen[0].objects[i].d5 = 1; | ||
| 12019 | custom_subscreen[0].objects[i].d6 = 1; | ||
| 12020 | break; | ||
| 12021 | }*/ | ||
| 12022 | |||
| 12023 | default: | ||
| 12024 | 803 | memcpy(&custom_subscreen[0].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12025 | 803 | break; | |
| 12026 | } | ||
| 12027 | 845 | } | |
| 12028 | |||
| 12029 | 13 | custom_subscreen[0].ss_type=sstACTIVE; | |
| 12030 | 13 | sprintf(custom_subscreen[0].name, "Active Subscreen (Triforce)"); | |
| 12031 | 13 | tempsub = default_subscreen_active[tempsubscreen][1]; | |
| 12032 | |||
| 12033 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 858 times.
✓ Branch 2 taken 845 times.
✓ Branch 3 taken 13 times.
|
858 | for(i=0; (i<MAXSUBSCREENITEMS&&tempsub[i].type!=ssoNULL); i++) |
| 12034 | { | ||
| 12035 |
2/3✓ Branch 0 taken 55 times.
✓ Branch 1 taken 790 times.
✗ Branch 2 not taken.
|
845 | switch(tempsub[i].type) |
| 12036 | { | ||
| 12037 | case ssoTEXT: | ||
| 12038 | case ssoTEXTBOX: | ||
| 12039 | case ssoCURRENTITEMTEXT: | ||
| 12040 | case ssoCURRENTITEMCLASSTEXT: | ||
| 12041 |
1/4✓ Branch 0 taken 55 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
55 | if(custom_subscreen[1].objects[i].dp1 != NULL) delete [](char *)custom_subscreen[1].objects[i].dp1; |
| 12042 | |||
| 12043 | 55 | memcpy(&custom_subscreen[1].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12044 | 55 | custom_subscreen[1].objects[i].dp1 = NULL; | |
| 12045 | 55 | custom_subscreen[1].objects[i].dp1 = new char[strlen((char*)tempsub[i].dp1)+1]; | |
| 12046 | 55 | strcpy((char*)custom_subscreen[1].objects[i].dp1,(char*)tempsub[i].dp1); | |
| 12047 | 55 | break; | |
| 12048 | |||
| 12049 | case ssoLIFEMETER: | ||
| 12050 | { | ||
| 12051 | ✗ | memcpy(&custom_subscreen[1].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12052 | |||
| 12053 | ✗ | if(get_bit(deprecated_rules, 12) != 0) | |
| 12054 | ✗ | custom_subscreen[1].objects[i].d3=1; | |
| 12055 | else | ||
| 12056 | ✗ | custom_subscreen[1].objects[i].d3=0; | |
| 12057 | |||
| 12058 | ✗ | break; | |
| 12059 | } | ||
| 12060 | /* | ||
| 12061 | case ssoTRIFRAME: | ||
| 12062 | { | ||
| 12063 | custom_subscreen[1].objects[i].d1 = 8594; | ||
| 12064 | custom_subscreen[1].objects[i].d2 = 8; | ||
| 12065 | custom_subscreen[1].objects[i].d3 = 8771; | ||
| 12066 | custom_subscreen[1].objects[i].d4 = 8; | ||
| 12067 | custom_subscreen[1].objects[i].d5 = 1; | ||
| 12068 | custom_subscreen[1].objects[i].d6 = 1; | ||
| 12069 | break; | ||
| 12070 | }*/ | ||
| 12071 | |||
| 12072 | default: | ||
| 12073 | 790 | memcpy(&custom_subscreen[1].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12074 | 790 | break; | |
| 12075 | } | ||
| 12076 | 845 | } | |
| 12077 | |||
| 12078 | 13 | custom_subscreen[1].ss_type=sstACTIVE; | |
| 12079 | 13 | sprintf(custom_subscreen[1].name, "Active Subscreen (Dungeon Map)"); | |
| 12080 | // memset(&custom_subscreen[1].objects[i],0,sizeof(subscreen_object)); | ||
| 12081 | 13 | tempsub = default_subscreen_passive[tempsubscreen][0]; | |
| 12082 | |||
| 12083 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 273 times.
✓ Branch 2 taken 260 times.
✓ Branch 3 taken 13 times.
|
273 | for(i=0; (i<MAXSUBSCREENITEMS&&tempsub[i].type!=ssoNULL); i++) |
| 12084 | { | ||
| 12085 |
3/3✓ Branch 0 taken 39 times.
✓ Branch 1 taken 208 times.
✓ Branch 2 taken 13 times.
|
260 | switch(tempsub[i].type) |
| 12086 | { | ||
| 12087 | case ssoTEXT: | ||
| 12088 | case ssoTEXTBOX: | ||
| 12089 | case ssoCURRENTITEMTEXT: | ||
| 12090 | case ssoCURRENTITEMCLASSTEXT: | ||
| 12091 |
1/4✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
39 | if(custom_subscreen[2].objects[i].dp1 != NULL) delete [](char *)custom_subscreen[2].objects[i].dp1; |
| 12092 | |||
| 12093 | 39 | memcpy(&custom_subscreen[2].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12094 | 39 | custom_subscreen[2].objects[i].dp1 = NULL; | |
| 12095 | 39 | custom_subscreen[2].objects[i].dp1 = new char[strlen((char*)tempsub[i].dp1)+1]; | |
| 12096 | 39 | strcpy((char*)custom_subscreen[2].objects[i].dp1,(char*)tempsub[i].dp1); | |
| 12097 | 39 | break; | |
| 12098 | |||
| 12099 | case ssoLIFEMETER: | ||
| 12100 | { | ||
| 12101 | 13 | memcpy(&custom_subscreen[2].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12102 | |||
| 12103 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | if(get_bit(deprecated_rules, 12) != 0) |
| 12104 | ✗ | custom_subscreen[2].objects[i].d3=1; | |
| 12105 | else | ||
| 12106 | 13 | custom_subscreen[2].objects[i].d3=0; | |
| 12107 | |||
| 12108 | 13 | break; | |
| 12109 | } | ||
| 12110 | |||
| 12111 | default: | ||
| 12112 | 208 | memcpy(&custom_subscreen[2].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12113 | 208 | break; | |
| 12114 | } | ||
| 12115 | 260 | } | |
| 12116 | |||
| 12117 | 13 | custom_subscreen[2].ss_type=sstPASSIVE; | |
| 12118 | 13 | sprintf(custom_subscreen[2].name, "Passive Subscreen (Magic)"); | |
| 12119 | // memset(&custom_subscreen[2].objects[i],0,sizeof(subscreen_object)); | ||
| 12120 | 13 | tempsub = default_subscreen_passive[tempsubscreen][1]; | |
| 12121 | |||
| 12122 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
✓ Branch 2 taken 247 times.
✓ Branch 3 taken 13 times.
|
260 | for(i=0; (i<MAXSUBSCREENITEMS&&tempsub[i].type!=ssoNULL); i++) |
| 12123 | { | ||
| 12124 |
3/3✓ Branch 0 taken 39 times.
✓ Branch 1 taken 195 times.
✓ Branch 2 taken 13 times.
|
247 | switch(tempsub[i].type) |
| 12125 | { | ||
| 12126 | case ssoTEXT: | ||
| 12127 | case ssoTEXTBOX: | ||
| 12128 | case ssoCURRENTITEMTEXT: | ||
| 12129 | case ssoCURRENTITEMCLASSTEXT: | ||
| 12130 |
1/4✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
39 | if(custom_subscreen[3].objects[i].dp1 != NULL) delete [](char *)custom_subscreen[3].objects[i].dp1; |
| 12131 | |||
| 12132 | 39 | memcpy(&custom_subscreen[3].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12133 | 39 | custom_subscreen[3].objects[i].dp1 = NULL; | |
| 12134 | 39 | custom_subscreen[3].objects[i].dp1 = new char[strlen((char*)tempsub[i].dp1)+1]; | |
| 12135 | 39 | strcpy((char*)custom_subscreen[3].objects[i].dp1,(char*)tempsub[i].dp1); | |
| 12136 | 39 | break; | |
| 12137 | |||
| 12138 | case ssoLIFEMETER: | ||
| 12139 | { | ||
| 12140 | 13 | memcpy(&custom_subscreen[3].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12141 | |||
| 12142 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | if(get_bit(deprecated_rules, 12) != 0) |
| 12143 | ✗ | custom_subscreen[3].objects[i].d3=1; | |
| 12144 | else | ||
| 12145 | 13 | custom_subscreen[3].objects[i].d3=0; | |
| 12146 | |||
| 12147 | 13 | break; | |
| 12148 | } | ||
| 12149 | |||
| 12150 | default: | ||
| 12151 | 195 | memcpy(&custom_subscreen[3].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12152 | 195 | break; | |
| 12153 | } | ||
| 12154 | 247 | } | |
| 12155 | |||
| 12156 | 13 | custom_subscreen[3].ss_type=sstPASSIVE; | |
| 12157 | 13 | sprintf(custom_subscreen[3].name, "Passive Subscreen (No Magic)"); | |
| 12158 | // memset(&custom_subscreen[3].objects[i],0,sizeof(subscreen_object)); | ||
| 12159 | 13 | break; | |
| 12160 | } | ||
| 12161 | |||
| 12162 | case ssdtZ3: | ||
| 12163 | { | ||
| 12164 | ✗ | tempsub = z3_active_a; | |
| 12165 | int32_t i; | ||
| 12166 | |||
| 12167 | ✗ | for(i=0; (i<MAXSUBSCREENITEMS&&tempsub[i].type!=ssoNULL); i++) | |
| 12168 | { | ||
| 12169 | ✗ | switch(tempsub[i].type) | |
| 12170 | { | ||
| 12171 | case ssoTEXT: | ||
| 12172 | case ssoTEXTBOX: | ||
| 12173 | case ssoCURRENTITEMTEXT: | ||
| 12174 | case ssoCURRENTITEMCLASSTEXT: | ||
| 12175 | ✗ | if(custom_subscreen[0].objects[i].dp1 != NULL) delete [](char *)custom_subscreen[0].objects[i].dp1; | |
| 12176 | |||
| 12177 | ✗ | memcpy(&custom_subscreen[0].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12178 | ✗ | custom_subscreen[0].objects[i].dp1 = NULL; | |
| 12179 | ✗ | custom_subscreen[0].objects[i].dp1 = new char[strlen((char*)tempsub[i].dp1)+1]; | |
| 12180 | ✗ | strcpy((char*)custom_subscreen[0].objects[i].dp1,(char*)tempsub[i].dp1); | |
| 12181 | ✗ | break; | |
| 12182 | |||
| 12183 | case ssoLIFEMETER: | ||
| 12184 | { | ||
| 12185 | ✗ | memcpy(&custom_subscreen[0].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12186 | |||
| 12187 | ✗ | if(get_bit(deprecated_rules, 12) != 0) | |
| 12188 | ✗ | custom_subscreen[0].objects[i].d3=1; | |
| 12189 | else | ||
| 12190 | ✗ | custom_subscreen[0].objects[i].d3=0; | |
| 12191 | |||
| 12192 | ✗ | break; | |
| 12193 | } | ||
| 12194 | |||
| 12195 | default: | ||
| 12196 | ✗ | memcpy(&custom_subscreen[0].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12197 | ✗ | break; | |
| 12198 | } | ||
| 12199 | } | ||
| 12200 | |||
| 12201 | ✗ | custom_subscreen[0].ss_type=sstACTIVE; | |
| 12202 | // memset(&custom_subscreen[0].objects[i],0,sizeof(subscreen_object)); | ||
| 12203 | ✗ | tempsub = z3_active_ab; | |
| 12204 | |||
| 12205 | ✗ | for(i=0; (i<MAXSUBSCREENITEMS&&tempsub[i].type!=ssoNULL); i++) | |
| 12206 | { | ||
| 12207 | ✗ | switch(tempsub[i].type) | |
| 12208 | { | ||
| 12209 | case ssoTEXT: | ||
| 12210 | case ssoTEXTBOX: | ||
| 12211 | case ssoCURRENTITEMTEXT: | ||
| 12212 | case ssoCURRENTITEMCLASSTEXT: | ||
| 12213 | ✗ | if(custom_subscreen[1].objects[i].dp1 != NULL) delete [](char *)custom_subscreen[1].objects[i].dp1; | |
| 12214 | |||
| 12215 | ✗ | memcpy(&custom_subscreen[1].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12216 | ✗ | custom_subscreen[1].objects[i].dp1 = NULL; | |
| 12217 | ✗ | custom_subscreen[1].objects[i].dp1 = new char[strlen((char*)tempsub[i].dp1)+1]; | |
| 12218 | ✗ | strcpy((char*)custom_subscreen[1].objects[i].dp1,(char*)tempsub[i].dp1); | |
| 12219 | ✗ | break; | |
| 12220 | |||
| 12221 | case ssoLIFEMETER: | ||
| 12222 | { | ||
| 12223 | ✗ | memcpy(&custom_subscreen[1].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12224 | |||
| 12225 | ✗ | if(get_bit(deprecated_rules, 12) != 0) | |
| 12226 | ✗ | custom_subscreen[1].objects[i].d3=1; | |
| 12227 | else | ||
| 12228 | ✗ | custom_subscreen[1].objects[i].d3=0; | |
| 12229 | |||
| 12230 | ✗ | break; | |
| 12231 | } | ||
| 12232 | |||
| 12233 | default: | ||
| 12234 | ✗ | memcpy(&custom_subscreen[1].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12235 | ✗ | break; | |
| 12236 | } | ||
| 12237 | } | ||
| 12238 | |||
| 12239 | ✗ | custom_subscreen[1].ss_type=sstACTIVE; | |
| 12240 | // memset(&custom_subscreen[1].objects[i],0,sizeof(subscreen_object)); | ||
| 12241 | ✗ | tempsub = z3_passive_a; | |
| 12242 | |||
| 12243 | ✗ | for(i=0; (i<MAXSUBSCREENITEMS&&tempsub[i].type!=ssoNULL); i++) | |
| 12244 | { | ||
| 12245 | ✗ | switch(tempsub[i].type) | |
| 12246 | { | ||
| 12247 | case ssoTEXT: | ||
| 12248 | case ssoTEXTBOX: | ||
| 12249 | case ssoCURRENTITEMTEXT: | ||
| 12250 | case ssoCURRENTITEMCLASSTEXT: | ||
| 12251 | ✗ | if(custom_subscreen[2].objects[i].dp1 != NULL) delete [](char *)custom_subscreen[2].objects[i].dp1; | |
| 12252 | |||
| 12253 | ✗ | memcpy(&custom_subscreen[2].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12254 | ✗ | custom_subscreen[2].objects[i].dp1 = NULL; | |
| 12255 | ✗ | custom_subscreen[2].objects[i].dp1 = new char[strlen((char*)tempsub[i].dp1)+1]; | |
| 12256 | ✗ | strcpy((char*)custom_subscreen[2].objects[i].dp1,(char*)tempsub[i].dp1); | |
| 12257 | ✗ | break; | |
| 12258 | |||
| 12259 | case ssoLIFEMETER: | ||
| 12260 | { | ||
| 12261 | ✗ | memcpy(&custom_subscreen[2].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12262 | |||
| 12263 | ✗ | if(get_bit(deprecated_rules, 12) != 0) | |
| 12264 | ✗ | custom_subscreen[2].objects[i].d3=1; | |
| 12265 | else | ||
| 12266 | ✗ | custom_subscreen[2].objects[i].d3=0; | |
| 12267 | |||
| 12268 | ✗ | break; | |
| 12269 | } | ||
| 12270 | |||
| 12271 | default: | ||
| 12272 | ✗ | memcpy(&custom_subscreen[2].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12273 | ✗ | break; | |
| 12274 | } | ||
| 12275 | } | ||
| 12276 | |||
| 12277 | ✗ | custom_subscreen[2].ss_type=sstPASSIVE; | |
| 12278 | // memset(&custom_subscreen[2].objects[i],0,sizeof(subscreen_object)); | ||
| 12279 | ✗ | tempsub = z3_passive_ab; | |
| 12280 | |||
| 12281 | ✗ | for(i=0; (i<MAXSUBSCREENITEMS&&tempsub[i].type!=ssoNULL); i++) | |
| 12282 | { | ||
| 12283 | ✗ | switch(tempsub[i].type) | |
| 12284 | { | ||
| 12285 | case ssoTEXT: | ||
| 12286 | case ssoTEXTBOX: | ||
| 12287 | case ssoCURRENTITEMTEXT: | ||
| 12288 | case ssoCURRENTITEMCLASSTEXT: | ||
| 12289 | ✗ | if(custom_subscreen[3].objects[i].dp1 != NULL) delete [](char *)custom_subscreen[3].objects[i].dp1; | |
| 12290 | |||
| 12291 | ✗ | memcpy(&custom_subscreen[3].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12292 | ✗ | custom_subscreen[3].objects[i].dp1 = NULL; | |
| 12293 | ✗ | custom_subscreen[3].objects[i].dp1 = new char[strlen((char*)tempsub[i].dp1)+1]; | |
| 12294 | ✗ | strcpy((char*)custom_subscreen[3].objects[i].dp1,(char*)tempsub[i].dp1); | |
| 12295 | ✗ | break; | |
| 12296 | |||
| 12297 | case ssoLIFEMETER: | ||
| 12298 | { | ||
| 12299 | ✗ | memcpy(&custom_subscreen[3].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12300 | |||
| 12301 | ✗ | if(get_bit(deprecated_rules, 12) != 0) | |
| 12302 | ✗ | custom_subscreen[3].objects[i].d3=1; | |
| 12303 | else | ||
| 12304 | ✗ | custom_subscreen[3].objects[i].d3=0; | |
| 12305 | |||
| 12306 | ✗ | break; | |
| 12307 | } | ||
| 12308 | |||
| 12309 | default: | ||
| 12310 | ✗ | memcpy(&custom_subscreen[3].objects[i],&tempsub[i],sizeof(subscreen_object)); | |
| 12311 | ✗ | break; | |
| 12312 | } | ||
| 12313 | } | ||
| 12314 | |||
| 12315 | ✗ | custom_subscreen[3].ss_type=sstPASSIVE; | |
| 12316 | // memset(&custom_subscreen[3].objects[i],0,sizeof(subscreen_object)); | ||
| 12317 | ✗ | break; | |
| 12318 | } | ||
| 12319 | } | ||
| 12320 | |||
| 12321 |
2/2✓ Branch 0 taken 13 times.
✓ Branch 1 taken 52 times.
|
65 | for(int32_t i=0; i<4; ++i) |
| 12322 | { | ||
| 12323 | 52 | purge_blank_subscreen_objects(&custom_subscreen[i]); | |
| 12324 | 52 | } | |
| 12325 | |||
| 12326 | 13 | return 0; | |
| 12327 | } | ||
| 12328 | |||
| 12329 | extern script_data *ffscripts[NUMSCRIPTFFC]; | ||
| 12330 | extern script_data *itemscripts[NUMSCRIPTITEM]; | ||
| 12331 | extern script_data *guyscripts[NUMSCRIPTGUYS]; | ||
| 12332 | extern script_data *wpnscripts[NUMSCRIPTWEAPONS]; | ||
| 12333 | extern script_data *lwpnscripts[NUMSCRIPTWEAPONS]; | ||
| 12334 | extern script_data *ewpnscripts[NUMSCRIPTWEAPONS]; | ||
| 12335 | extern script_data *globalscripts[NUMSCRIPTGLOBAL]; | ||
| 12336 | extern script_data *genericscripts[NUMSCRIPTSGENERIC]; | ||
| 12337 | extern script_data *playerscripts[NUMSCRIPTPLAYER]; | ||
| 12338 | extern script_data *screenscripts[NUMSCRIPTSCREEN]; | ||
| 12339 | extern script_data *dmapscripts[NUMSCRIPTSDMAP]; | ||
| 12340 | extern script_data *itemspritescripts[NUMSCRIPTSITEMSPRITE]; | ||
| 12341 | extern script_data *comboscripts[NUMSCRIPTSCOMBODATA]; | ||
| 12342 | //script_data *wpnscripts[NUMSCRIPTWEAPONS]; //used only for old data | ||
| 12343 | |||
| 12344 | |||
| 12345 | |||
| 12346 | 77 | int32_t readffscript(PACKFILE *f, zquestheader *Header, bool keepdata) | |
| 12347 | { | ||
| 12348 | int32_t dummy; | ||
| 12349 | 77 | word s_version=0, s_cversion=0, zmeta_version=0; | |
| 12350 | 77 | byte numscripts=0; | |
| 12351 | 77 | numscripts=numscripts; //to avoid unused variables warnings | |
| 12352 | int32_t ret; | ||
| 12353 | |||
| 12354 | //section version info | ||
| 12355 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(!p_igetw(&s_version,f,true)) |
| 12356 | { | ||
| 12357 | ✗ | return qe_invalid; | |
| 12358 | } | ||
| 12359 | |||
| 12360 | 77 | FFCore.quest_format[vFFScript] = s_version; | |
| 12361 | |||
| 12362 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_cversion,f,true)) |
| 12363 | { | ||
| 12364 | ✗ | return qe_invalid; | |
| 12365 | } | ||
| 12366 | |||
| 12367 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
|
77 | if(s_version >= 18) |
| 12368 | { | ||
| 12369 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(!p_igetw(&zmeta_version,f,true)) |
| 12370 | { | ||
| 12371 | ✗ | return qe_invalid; | |
| 12372 | } | ||
| 12373 | 8 | } | |
| 12374 | |||
| 12375 | //al_trace("Scripts version %d\n", s_version); | ||
| 12376 | //section size | ||
| 12377 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&dummy,f,true)) |
| 12378 | { | ||
| 12379 | ✗ | return qe_invalid; | |
| 12380 | } | ||
| 12381 | |||
| 12382 | //ZScriptVersion::setVersion(s_version); ~this ideally, but there's no ZC/ZQuest defines... | ||
| 12383 | 77 | setZScriptVersion(s_version); //Lumped in zelda.cpp and in zquest.cpp as zquest can't link ZScriptVersion | |
| 12384 | 77 | temp_ffscript_version = s_version; | |
| 12385 | //miscQdata *the_misc; | ||
| 12386 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if ( FFCore.quest_format[vLastCompile] < 13 ) FFCore.quest_format[vLastCompile] = s_version; |
| 12387 | 77 | al_trace("Loaded scripts last compiled in ZScript version: %d\n", (FFCore.quest_format[vLastCompile])); | |
| 12388 | |||
| 12389 | //finally... section data | ||
| 12390 |
2/2✓ Branch 0 taken 39424 times.
✓ Branch 1 taken 77 times.
|
39501 | for(int32_t i = 0; i < ((s_version < 2) ? NUMSCRIPTFFCOLD : NUMSCRIPTFFC); i++) |
| 12391 | { | ||
| 12392 | 39424 | ret = read_one_ffscript(f, Header, keepdata, i, s_version, s_cversion, &ffscripts[i], zmeta_version); | |
| 12393 | |||
| 12394 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(ret != 0) return qe_invalid; |
| 12395 | 39424 | } | |
| 12396 | |||
| 12397 | /* HIGHLY UNORTHODOX UPDATING THING, by Deedee | ||
| 12398 | * This fixes changes to sprite jump values introduced in early 2.55 alphas. | ||
| 12399 | * Zoria didn't bump up the versions as liberally as he should have, but thankfully | ||
| 12400 | * there was a version bump a week before a change that broke stuff. | ||
| 12401 | */ | ||
| 12402 |
6/8✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 8 times.
✓ Branch 7 taken 69 times.
|
77 | if(((Header->zelda_version < 0x253)||((Header->zelda_version == 0x253)&&(Header->build<33))||((Header->zelda_version > 0x253) && s_version < 12)) && keepdata) |
| 12403 | { | ||
| 12404 | 69 | set_bit(quest_rules,qr_SPRITE_JUMP_IS_TRUNCATED,1); | |
| 12405 | 69 | } | |
| 12406 |
3/4✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 69 times.
|
77 | if(s_version < 19 && keepdata) |
| 12407 | { | ||
| 12408 | 69 | set_bit(quest_rules,qr_FLUCTUATING_ENEMY_JUMP,1); | |
| 12409 | 69 | } | |
| 12410 | |||
| 12411 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(s_version > 1) |
| 12412 | { | ||
| 12413 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i = 0; i < NUMSCRIPTITEM; i++) |
| 12414 | { | ||
| 12415 | 19712 | ret = read_one_ffscript(f, Header, keepdata, i, s_version, s_cversion, &itemscripts[i], zmeta_version); | |
| 12416 | |||
| 12417 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(ret != 0) return qe_invalid; |
| 12418 | 19712 | } | |
| 12419 | |||
| 12420 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i = 0; i < NUMSCRIPTGUYS; i++) |
| 12421 | { | ||
| 12422 | 19712 | ret = read_one_ffscript(f, Header, keepdata, i, s_version, s_cversion, &guyscripts[i], zmeta_version); | |
| 12423 | |||
| 12424 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(ret != 0) return qe_invalid; |
| 12425 | 19712 | } | |
| 12426 | |||
| 12427 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) |
| 12428 | { | ||
| 12429 | 19712 | ret = read_one_ffscript(f, Header, keepdata, i, s_version, s_cversion, &wpnscripts[i], zmeta_version); | |
| 12430 | |||
| 12431 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(ret != 0) return qe_invalid; |
| 12432 | 19712 | } | |
| 12433 | |||
| 12434 | |||
| 12435 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i = 0; i < NUMSCRIPTSCREEN; i++) |
| 12436 | { | ||
| 12437 | 19712 | ret = read_one_ffscript(f, Header, keepdata, i, s_version, s_cversion, &screenscripts[i], zmeta_version); | |
| 12438 | |||
| 12439 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | if(ret != 0) return qe_invalid; |
| 12440 | 19712 | } | |
| 12441 | |||
| 12442 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(s_version > 16) |
| 12443 | { | ||
| 12444 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 8 times.
|
72 | for(int32_t i = 0; i < NUMSCRIPTGLOBAL; ++i) |
| 12445 | { | ||
| 12446 | 64 | ret = read_one_ffscript(f, Header, keepdata, i, s_version, s_cversion, &globalscripts[i], zmeta_version); | |
| 12447 | |||
| 12448 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(ret != 0) return qe_invalid; |
| 12449 | 64 | } | |
| 12450 | 8 | } | |
| 12451 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | else if(s_version > 13) |
| 12452 | { | ||
| 12453 | ✗ | for(int32_t i = 0; i < NUMSCRIPTGLOBAL255OLD; ++i) | |
| 12454 | { | ||
| 12455 | ✗ | ret = read_one_ffscript(f, Header, keepdata, i, s_version, s_cversion, &globalscripts[i], zmeta_version); | |
| 12456 | |||
| 12457 | ✗ | if(ret != 0) return qe_invalid; | |
| 12458 | } | ||
| 12459 | |||
| 12460 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVE] != NULL) | |
| 12461 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONSAVE]; | |
| 12462 | |||
| 12463 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVE] = new script_data(); | |
| 12464 | } | ||
| 12465 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | else if(s_version > 4) |
| 12466 | { | ||
| 12467 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 69 times.
|
345 | for(int32_t i = 0; i < NUMSCRIPTGLOBAL253; ++i) |
| 12468 | { | ||
| 12469 | 276 | ret = read_one_ffscript(f, Header, keepdata, i, s_version, s_cversion, &globalscripts[i], zmeta_version); | |
| 12470 | |||
| 12471 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(ret != 0) return qe_invalid; |
| 12472 | 276 | } | |
| 12473 | |||
| 12474 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if(globalscripts[GLOBAL_SCRIPT_ONLAUNCH] != NULL) |
| 12475 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | delete globalscripts[GLOBAL_SCRIPT_ONLAUNCH]; |
| 12476 | |||
| 12477 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | globalscripts[GLOBAL_SCRIPT_ONLAUNCH] = new script_data(); |
| 12478 | |||
| 12479 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if(globalscripts[GLOBAL_SCRIPT_ONCONTGAME] != NULL) |
| 12480 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | delete globalscripts[GLOBAL_SCRIPT_ONCONTGAME]; |
| 12481 | |||
| 12482 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | globalscripts[GLOBAL_SCRIPT_ONCONTGAME] = new script_data(); |
| 12483 | |||
| 12484 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if(globalscripts[GLOBAL_SCRIPT_F6] != NULL) |
| 12485 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | delete globalscripts[GLOBAL_SCRIPT_F6]; |
| 12486 | |||
| 12487 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | globalscripts[GLOBAL_SCRIPT_F6] = new script_data(); |
| 12488 | |||
| 12489 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if(globalscripts[GLOBAL_SCRIPT_ONSAVE] != NULL) |
| 12490 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | delete globalscripts[GLOBAL_SCRIPT_ONSAVE]; |
| 12491 | |||
| 12492 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | globalscripts[GLOBAL_SCRIPT_ONSAVE] = new script_data(); |
| 12493 | 69 | } | |
| 12494 | else | ||
| 12495 | { | ||
| 12496 | ✗ | for(int32_t i = 0; i < NUMSCRIPTGLOBALOLD; i++) | |
| 12497 | { | ||
| 12498 | ✗ | ret = read_one_ffscript(f, Header, keepdata, i, s_version, s_cversion, &globalscripts[i], zmeta_version); | |
| 12499 | |||
| 12500 | ✗ | if(ret != 0) return qe_invalid; | |
| 12501 | } | ||
| 12502 | |||
| 12503 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVELOAD] != NULL) | |
| 12504 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONSAVELOAD]; | |
| 12505 | |||
| 12506 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVELOAD] = new script_data(); | |
| 12507 | |||
| 12508 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONLAUNCH] != NULL) | |
| 12509 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONLAUNCH]; | |
| 12510 | |||
| 12511 | ✗ | globalscripts[GLOBAL_SCRIPT_ONLAUNCH] = new script_data(); | |
| 12512 | |||
| 12513 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONCONTGAME] != NULL) | |
| 12514 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONCONTGAME]; | |
| 12515 | |||
| 12516 | ✗ | globalscripts[GLOBAL_SCRIPT_ONCONTGAME] = new script_data(); | |
| 12517 | |||
| 12518 | ✗ | if(globalscripts[GLOBAL_SCRIPT_F6] != NULL) | |
| 12519 | ✗ | delete globalscripts[GLOBAL_SCRIPT_F6]; | |
| 12520 | |||
| 12521 | ✗ | globalscripts[GLOBAL_SCRIPT_F6] = new script_data(); | |
| 12522 | |||
| 12523 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVE] != NULL) | |
| 12524 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONSAVE]; | |
| 12525 | |||
| 12526 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVE] = new script_data(); | |
| 12527 | } | ||
| 12528 | |||
| 12529 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(s_version > 10) //expanded the number of Player scripts to 5. |
| 12530 | { | ||
| 12531 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 8 times.
|
48 | for(int32_t i = 0; i < NUMSCRIPTPLAYER; i++) |
| 12532 | { | ||
| 12533 | 40 | ret = read_one_ffscript(f, Header, keepdata, i, s_version, s_cversion, &playerscripts[i], zmeta_version); | |
| 12534 | |||
| 12535 |
1/2✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
|
40 | if(ret != 0) return qe_invalid; |
| 12536 | 40 | } | |
| 12537 | 8 | } | |
| 12538 | else | ||
| 12539 | { | ||
| 12540 |
2/2✓ Branch 0 taken 207 times.
✓ Branch 1 taken 69 times.
|
276 | for(int32_t i = 0; i < NUMSCRIPTHEROOLD; i++) |
| 12541 | { | ||
| 12542 | 207 | ret = read_one_ffscript(f, Header, keepdata, i, s_version, s_cversion, &playerscripts[i], zmeta_version); | |
| 12543 | |||
| 12544 |
1/2✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
|
207 | if(ret != 0) return qe_invalid; |
| 12545 | 207 | } | |
| 12546 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | if(playerscripts[3] != NULL) |
| 12547 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | delete playerscripts[3]; |
| 12548 | |||
| 12549 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | playerscripts[3] = new script_data(); |
| 12550 | |||
| 12551 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | if(playerscripts[4] != NULL) |
| 12552 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | delete playerscripts[4]; |
| 12553 | |||
| 12554 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | playerscripts[4] = new script_data(); |
| 12555 | } | ||
| 12556 |
3/4✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
77 | if(s_version > 8 && s_version < 10) |
| 12557 | { | ||
| 12558 | |||
| 12559 | ✗ | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) | |
| 12560 | { | ||
| 12561 | ✗ | ret = read_one_ffscript(f, Header, keepdata, i, s_version, s_cversion, &ewpnscripts[i], zmeta_version); | |
| 12562 | |||
| 12563 | ✗ | if(ret != 0) return qe_invalid; | |
| 12564 | } | ||
| 12565 | ✗ | for(int32_t i = 0; i < NUMSCRIPTSDMAP; i++) | |
| 12566 | { | ||
| 12567 | ✗ | ret = read_one_ffscript(f, Header, keepdata, i, s_version, s_cversion, &dmapscripts[i], zmeta_version); | |
| 12568 | |||
| 12569 | ✗ | if(ret != 0) return qe_invalid; | |
| 12570 | } | ||
| 12571 | |||
| 12572 | } | ||
| 12573 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
|
77 | if(s_version >= 10) |
| 12574 | { | ||
| 12575 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 8 times.
|
2056 | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) |
| 12576 | { | ||
| 12577 | 2048 | ret = read_one_ffscript(f, Header, keepdata, i, s_version, s_cversion, &lwpnscripts[i], zmeta_version); | |
| 12578 | |||
| 12579 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(ret != 0) return qe_invalid; |
| 12580 | 2048 | } | |
| 12581 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 8 times.
|
2056 | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) |
| 12582 | { | ||
| 12583 | 2048 | ret = read_one_ffscript(f, Header, keepdata, i, s_version, s_cversion, &ewpnscripts[i], zmeta_version); | |
| 12584 | |||
| 12585 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(ret != 0) return qe_invalid; |
| 12586 | 2048 | } | |
| 12587 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 8 times.
|
2056 | for(int32_t i = 0; i < NUMSCRIPTSDMAP; i++) |
| 12588 | { | ||
| 12589 | 2048 | ret = read_one_ffscript(f, Header, keepdata, i, s_version, s_cversion, &dmapscripts[i], zmeta_version); | |
| 12590 | |||
| 12591 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(ret != 0) return qe_invalid; |
| 12592 | 2048 | } | |
| 12593 | |||
| 12594 | 8 | } | |
| 12595 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
|
77 | if(s_version >=12) |
| 12596 | { | ||
| 12597 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 8 times.
|
2056 | for(int32_t i = 0; i < NUMSCRIPTSITEMSPRITE; i++) |
| 12598 | { | ||
| 12599 | 2048 | ret = read_one_ffscript(f, Header, keepdata, i, s_version, s_cversion, &itemspritescripts[i], zmeta_version); | |
| 12600 | |||
| 12601 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(ret != 0) return qe_invalid; |
| 12602 | 2048 | } | |
| 12603 | 8 | } | |
| 12604 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
|
77 | if(s_version >=15) |
| 12605 | { | ||
| 12606 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 8 times.
|
4104 | for(int32_t i = 0; i < NUMSCRIPTSCOMBODATA; i++) |
| 12607 | { | ||
| 12608 | 4096 | ret = read_one_ffscript(f, Header, keepdata, i, s_version, s_cversion, &comboscripts[i], zmeta_version); | |
| 12609 | |||
| 12610 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(ret != 0) return qe_invalid; |
| 12611 | 4096 | } | |
| 12612 | 8 | } | |
| 12613 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
|
77 | if(s_version >19) |
| 12614 | { | ||
| 12615 | 8 | word numgenscripts = NUMSCRIPTSGENERIC; | |
| 12616 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(!p_igetw(&numgenscripts,f,true)) |
| 12617 | { | ||
| 12618 | ✗ | return qe_invalid; | |
| 12619 | } | ||
| 12620 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 8 times.
|
4104 | for(int32_t i = 0; i < numgenscripts; i++) |
| 12621 | { | ||
| 12622 | 4096 | ret = read_one_ffscript(f, Header, keepdata, i, s_version, s_cversion, &genericscripts[i], zmeta_version); | |
| 12623 | |||
| 12624 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(ret != 0) return qe_invalid; |
| 12625 | 4096 | } | |
| 12626 | 8 | } | |
| 12627 | |||
| 12628 | /* | ||
| 12629 | else //Is this trip really necessary? | ||
| 12630 | { | ||
| 12631 | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) | ||
| 12632 | { | ||
| 12633 | |||
| 12634 | ewpnscripts[i] = NULL; | ||
| 12635 | } | ||
| 12636 | for(int32_t i = 0; i < NUMSCRIPTSDMAP; i++) | ||
| 12637 | { | ||
| 12638 | dmapscripts[i] = NULL; | ||
| 12639 | } | ||
| 12640 | } | ||
| 12641 | */ | ||
| 12642 | |||
| 12643 | 77 | } | |
| 12644 | |||
| 12645 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(s_version > 2) |
| 12646 | { | ||
| 12647 | int32_t bufsize; | ||
| 12648 | 77 | p_igetl(&bufsize, f, true); | |
| 12649 | 77 | char * buf = new char[bufsize+1]; | |
| 12650 | 77 | pfread(buf, bufsize, f, true); | |
| 12651 | 77 | buf[bufsize]=0; | |
| 12652 | |||
| 12653 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata) |
| 12654 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | zScript = string(buf); |
| 12655 | |||
| 12656 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | delete[] buf; |
| 12657 | word numffcbindings; | ||
| 12658 | 77 | p_igetw(&numffcbindings, f, true); | |
| 12659 | |||
| 12660 |
2/2✓ Branch 0 taken 758 times.
✓ Branch 1 taken 77 times.
|
835 | for(int32_t i=0; i<numffcbindings; i++) |
| 12661 | { | ||
| 12662 | word id; | ||
| 12663 | 758 | p_igetw(&id, f, true); | |
| 12664 | 758 | p_igetl(&bufsize, f, true); | |
| 12665 | 758 | buf = new char[bufsize+1]; | |
| 12666 | 758 | pfread(buf, bufsize, f, true); | |
| 12667 | 758 | buf[bufsize]=0; | |
| 12668 | |||
| 12669 | //fix for buggy older saved quests -DD | ||
| 12670 |
2/4✓ Branch 0 taken 758 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 758 times.
|
758 | if(keepdata && id < NUMSCRIPTFFC-1) |
| 12671 | 758 | ffcmap[id].scriptname = buf; | |
| 12672 | |||
| 12673 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 758 times.
|
758 | delete[] buf; |
| 12674 | 758 | } | |
| 12675 | |||
| 12676 | word numglobalbindings; | ||
| 12677 | 77 | p_igetw(&numglobalbindings, f, true); | |
| 12678 | |||
| 12679 |
2/2✓ Branch 0 taken 346 times.
✓ Branch 1 taken 77 times.
|
423 | for(int32_t i=0; i<numglobalbindings; i++) |
| 12680 | { | ||
| 12681 | word id; | ||
| 12682 | 346 | p_igetw(&id, f, true); | |
| 12683 | 346 | p_igetl(&bufsize, f, true); | |
| 12684 | 346 | buf = new char[bufsize+1]; | |
| 12685 | 346 | pfread(buf, bufsize, f, true); | |
| 12686 | 346 | buf[bufsize]=0; | |
| 12687 | |||
| 12688 | // id in principle should be valid, since slot assignment cannot assign a global script to a bogus slot. | ||
| 12689 | // However, because of a corruption bug, some 2.50.x quests contain bogus entries in the global bindings table. | ||
| 12690 | // Ignore these. -DD | ||
| 12691 |
4/6✓ Branch 0 taken 346 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 346 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 143 times.
✓ Branch 5 taken 203 times.
|
346 | if(keepdata && id >= 0 && id < NUMSCRIPTGLOBAL) |
| 12692 | { | ||
| 12693 | //Disable old '~Continue's, they'd wreak havoc. Bit messy, apologies ~Joe | ||
| 12694 |
1/2✓ Branch 0 taken 203 times.
✗ Branch 1 not taken.
|
203 | if(strcmp(buf,"~Continue") == 0) |
| 12695 | { | ||
| 12696 | ✗ | globalmap[id].scriptname = ""; | |
| 12697 | |||
| 12698 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVELOAD] != NULL) | |
| 12699 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVELOAD]->disable(); | |
| 12700 | } | ||
| 12701 | else | ||
| 12702 | { | ||
| 12703 | 203 | globalmap[id].scriptname = buf; | |
| 12704 | } | ||
| 12705 | 203 | } | |
| 12706 | |||
| 12707 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 346 times.
|
346 | delete[] buf; |
| 12708 | 346 | } | |
| 12709 | |||
| 12710 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(s_version > 3) |
| 12711 | { | ||
| 12712 | word numitembindings; | ||
| 12713 | 77 | p_igetw(&numitembindings, f, true); | |
| 12714 | |||
| 12715 |
2/2✓ Branch 0 taken 57 times.
✓ Branch 1 taken 77 times.
|
134 | for(int32_t i=0; i<numitembindings; i++) |
| 12716 | { | ||
| 12717 | word id; | ||
| 12718 | 57 | p_igetw(&id, f, true); | |
| 12719 | 57 | p_igetl(&bufsize, f, true); | |
| 12720 | 57 | buf = new char[bufsize+1]; | |
| 12721 | 57 | pfread(buf, bufsize, f, true); | |
| 12722 | 57 | buf[bufsize]=0; | |
| 12723 | |||
| 12724 | //fix this too | ||
| 12725 |
2/4✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 57 times.
|
57 | if(keepdata && id <NUMSCRIPTITEM-1) |
| 12726 | 57 | itemmap[id].scriptname = buf; | |
| 12727 | |||
| 12728 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
57 | delete[] buf; |
| 12729 | 57 | } | |
| 12730 | 77 | } | |
| 12731 | //(v9+) | ||
| 12732 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
|
77 | if(s_version > 8) |
| 12733 | { | ||
| 12734 | //npc scripts | ||
| 12735 | word numnpcbindings; | ||
| 12736 | 8 | p_igetw(&numnpcbindings, f, true); | |
| 12737 | |||
| 12738 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 8 times.
|
20 | for(int32_t i=0; i<numnpcbindings; i++) |
| 12739 | { | ||
| 12740 | word id; | ||
| 12741 | 12 | p_igetw(&id, f, true); | |
| 12742 | 12 | p_igetl(&bufsize, f, true); | |
| 12743 | 12 | buf = new char[bufsize+1]; | |
| 12744 | 12 | pfread(buf, bufsize, f, true); | |
| 12745 | 12 | buf[bufsize]=0; | |
| 12746 | |||
| 12747 | //fix this too | ||
| 12748 |
2/4✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 12 times.
|
12 | if(keepdata && id <NUMSCRIPTGUYS-1) |
| 12749 | 12 | npcmap[id].scriptname = buf; | |
| 12750 | |||
| 12751 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | delete[] buf; |
| 12752 | 12 | } | |
| 12753 | //lweapon | ||
| 12754 | word numlwpnbindings; | ||
| 12755 | 8 | p_igetw(&numlwpnbindings, f, true); | |
| 12756 | |||
| 12757 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 8 times.
|
50 | for(int32_t i=0; i<numlwpnbindings; i++) |
| 12758 | { | ||
| 12759 | word id; | ||
| 12760 | 42 | p_igetw(&id, f, true); | |
| 12761 | 42 | p_igetl(&bufsize, f, true); | |
| 12762 | 42 | buf = new char[bufsize+1]; | |
| 12763 | 42 | pfread(buf, bufsize, f, true); | |
| 12764 | 42 | buf[bufsize]=0; | |
| 12765 | |||
| 12766 | //fix this too | ||
| 12767 |
2/4✓ Branch 0 taken 42 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 42 times.
|
42 | if(keepdata && id <NUMSCRIPTWEAPONS-1) |
| 12768 | 42 | lwpnmap[id].scriptname = buf; | |
| 12769 | |||
| 12770 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 42 times.
|
42 | delete[] buf; |
| 12771 | 42 | } | |
| 12772 | //eweapon | ||
| 12773 | word numewpnbindings; | ||
| 12774 | 8 | p_igetw(&numewpnbindings, f, true); | |
| 12775 | |||
| 12776 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 8 times.
|
71 | for(int32_t i=0; i<numewpnbindings; i++) |
| 12777 | { | ||
| 12778 | word id; | ||
| 12779 | 63 | p_igetw(&id, f, true); | |
| 12780 | 63 | p_igetl(&bufsize, f, true); | |
| 12781 | 63 | buf = new char[bufsize+1]; | |
| 12782 | 63 | pfread(buf, bufsize, f, true); | |
| 12783 | 63 | buf[bufsize]=0; | |
| 12784 | |||
| 12785 | //fix this too | ||
| 12786 |
2/4✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 63 times.
|
63 | if(keepdata && id <NUMSCRIPTWEAPONS-1) |
| 12787 | 63 | ewpnmap[id].scriptname = buf; | |
| 12788 | |||
| 12789 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63 times.
|
63 | delete[] buf; |
| 12790 | 63 | } | |
| 12791 | //hero | ||
| 12792 | word numherobindings; | ||
| 12793 | 8 | p_igetw(&numherobindings, f, true); | |
| 12794 | |||
| 12795 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 8 times.
|
11 | for(int32_t i=0; i<numherobindings; i++) |
| 12796 | { | ||
| 12797 | word id; | ||
| 12798 | 3 | p_igetw(&id, f, true); | |
| 12799 | 3 | p_igetl(&bufsize, f, true); | |
| 12800 | 3 | buf = new char[bufsize+1]; | |
| 12801 | 3 | pfread(buf, bufsize, f, true); | |
| 12802 | 3 | buf[bufsize]=0; | |
| 12803 | |||
| 12804 | //fix this too | ||
| 12805 |
2/4✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
|
3 | if(keepdata && id <NUMSCRIPTPLAYER-1) |
| 12806 | 3 | playermap[id].scriptname = buf; | |
| 12807 | |||
| 12808 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | delete[] buf; |
| 12809 | 3 | } | |
| 12810 | //dmaps | ||
| 12811 | word numdmapbindings; | ||
| 12812 | 8 | p_igetw(&numdmapbindings, f, true); | |
| 12813 | |||
| 12814 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 8 times.
|
22 | for(int32_t i=0; i<numdmapbindings; i++) |
| 12815 | { | ||
| 12816 | word id; | ||
| 12817 | 14 | p_igetw(&id, f, true); | |
| 12818 | 14 | p_igetl(&bufsize, f, true); | |
| 12819 | 14 | buf = new char[bufsize+1]; | |
| 12820 | 14 | pfread(buf, bufsize, f, true); | |
| 12821 | 14 | buf[bufsize]=0; | |
| 12822 | |||
| 12823 | //fix this too | ||
| 12824 |
2/4✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 14 times.
|
14 | if(keepdata && id <NUMSCRIPTSDMAP-1) |
| 12825 | 14 | dmapmap[id].scriptname = buf; | |
| 12826 | |||
| 12827 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | delete[] buf; |
| 12828 | 14 | } | |
| 12829 | //screen | ||
| 12830 | word numscreenbindings; | ||
| 12831 | 8 | p_igetw(&numscreenbindings, f, true); | |
| 12832 | |||
| 12833 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 8 times.
|
12 | for(int32_t i=0; i<numscreenbindings; i++) |
| 12834 | { | ||
| 12835 | word id; | ||
| 12836 | 4 | p_igetw(&id, f, true); | |
| 12837 | 4 | p_igetl(&bufsize, f, true); | |
| 12838 | 4 | buf = new char[bufsize+1]; | |
| 12839 | 4 | pfread(buf, bufsize, f, true); | |
| 12840 | 4 | buf[bufsize]=0; | |
| 12841 | |||
| 12842 | //fix this too | ||
| 12843 |
2/4✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
|
4 | if(keepdata && id <NUMSCRIPTSDMAP-1) |
| 12844 | 4 | screenmap[id].scriptname = buf; | |
| 12845 | |||
| 12846 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | delete[] buf; |
| 12847 | 4 | } | |
| 12848 | 8 | } | |
| 12849 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
|
77 | if(s_version > 11) |
| 12850 | { | ||
| 12851 | word numspritebindings; | ||
| 12852 | 8 | p_igetw(&numspritebindings, f, true); | |
| 12853 | |||
| 12854 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 8 times.
|
18 | for(int32_t i=0; i<numspritebindings; i++) |
| 12855 | { | ||
| 12856 | word id; | ||
| 12857 | 10 | p_igetw(&id, f, true); | |
| 12858 | 10 | p_igetl(&bufsize, f, true); | |
| 12859 | 10 | buf = new char[bufsize+1]; | |
| 12860 | 10 | pfread(buf, bufsize, f, true); | |
| 12861 | 10 | buf[bufsize]=0; | |
| 12862 | |||
| 12863 | //fix this too | ||
| 12864 |
2/4✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 10 times.
|
10 | if(keepdata && id <NUMSCRIPTSDMAP-1) |
| 12865 | 10 | itemspritemap[id].scriptname = buf; | |
| 12866 | |||
| 12867 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | delete[] buf; |
| 12868 | 10 | } | |
| 12869 | 8 | } | |
| 12870 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
|
77 | if(s_version >= 15) |
| 12871 | { | ||
| 12872 | word numcombobindings; | ||
| 12873 | 8 | p_igetw(&numcombobindings, f, true); | |
| 12874 | |||
| 12875 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 8 times.
|
32 | for(int32_t i=0; i<numcombobindings; i++) |
| 12876 | { | ||
| 12877 | word id; | ||
| 12878 | 24 | p_igetw(&id, f, true); | |
| 12879 | 24 | p_igetl(&bufsize, f, true); | |
| 12880 | 24 | buf = new char[bufsize+1]; | |
| 12881 | 24 | pfread(buf, bufsize, f, true); | |
| 12882 | 24 | buf[bufsize]=0; | |
| 12883 | |||
| 12884 | //fix this too | ||
| 12885 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
|
24 | if(keepdata && id <NUMSCRIPTSCOMBODATA-1) |
| 12886 | 24 | comboscriptmap[id].scriptname = buf; | |
| 12887 | |||
| 12888 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | delete[] buf; |
| 12889 | 24 | } | |
| 12890 | 8 | } | |
| 12891 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
|
77 | if(s_version > 19) |
| 12892 | { | ||
| 12893 | word numgenericbindings; | ||
| 12894 | 8 | p_igetw(&numgenericbindings, f, true); | |
| 12895 | |||
| 12896 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 8 times.
|
22 | for(int32_t i=0; i<numgenericbindings; i++) |
| 12897 | { | ||
| 12898 | word id; | ||
| 12899 | 14 | p_igetw(&id, f, true); | |
| 12900 | 14 | p_igetl(&bufsize, f, true); | |
| 12901 | 14 | buf = new char[bufsize+1]; | |
| 12902 | 14 | pfread(buf, bufsize, f, true); | |
| 12903 | 14 | buf[bufsize]=0; | |
| 12904 | |||
| 12905 | //fix this too | ||
| 12906 |
2/4✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 14 times.
|
14 | if(keepdata && id <NUMSCRIPTSGENERIC-1) |
| 12907 | 14 | genericmap[id].scriptname = buf; | |
| 12908 | |||
| 12909 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | delete[] buf; |
| 12910 | 14 | } | |
| 12911 | 8 | } | |
| 12912 | 77 | } | |
| 12913 | |||
| 12914 | 77 | return 0; | |
| 12915 | 77 | } | |
| 12916 | |||
| 12917 | 77 | void reset_scripts() | |
| 12918 | { | ||
| 12919 | //OK, who spaced this? ;) | ||
| 12920 |
2/2✓ Branch 0 taken 39424 times.
✓ Branch 1 taken 77 times.
|
39501 | for(int32_t i=0; i<NUMSCRIPTFFC; i++) |
| 12921 | { | ||
| 12922 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 39424 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 39424 times.
|
39424 | if(ffscripts[i]!=NULL) delete ffscripts[i]; |
| 12923 | 39424 | } | |
| 12924 | |||
| 12925 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<NUMSCRIPTITEM; i++) |
| 12926 | { | ||
| 12927 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 19712 times.
|
19712 | if(itemscripts[i]!=NULL) delete itemscripts[i]; |
| 12928 | 19712 | } | |
| 12929 | |||
| 12930 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<NUMSCRIPTGUYS; i++) |
| 12931 | { | ||
| 12932 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 19712 times.
|
19712 | if(guyscripts[i]!=NULL) delete guyscripts[i]; |
| 12933 | 19712 | } | |
| 12934 | |||
| 12935 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<NUMSCRIPTWEAPONS; i++) |
| 12936 | { | ||
| 12937 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 19712 times.
|
19712 | if(wpnscripts[i]!=NULL) delete wpnscripts[i]; |
| 12938 | 19712 | } | |
| 12939 | |||
| 12940 | |||
| 12941 | |||
| 12942 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<NUMSCRIPTSCREEN; i++) |
| 12943 | { | ||
| 12944 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 19712 times.
|
19712 | if(screenscripts[i]!=NULL) delete screenscripts[i]; |
| 12945 | 19712 | } | |
| 12946 | |||
| 12947 |
2/2✓ Branch 0 taken 616 times.
✓ Branch 1 taken 77 times.
|
693 | for(int32_t i=0; i<NUMSCRIPTGLOBAL; i++) |
| 12948 | { | ||
| 12949 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 616 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 616 times.
|
616 | if(globalscripts[i]!=NULL) delete globalscripts[i]; |
| 12950 | 616 | } | |
| 12951 | |||
| 12952 |
2/2✓ Branch 0 taken 385 times.
✓ Branch 1 taken 77 times.
|
462 | for(int32_t i=0; i<NUMSCRIPTPLAYER; i++) |
| 12953 | { | ||
| 12954 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 385 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 385 times.
|
385 | if(playerscripts[i]!=NULL) delete playerscripts[i]; |
| 12955 | 385 | } | |
| 12956 | |||
| 12957 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<NUMSCRIPTWEAPONS; i++) |
| 12958 | { | ||
| 12959 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 19712 times.
|
19712 | if(lwpnscripts[i]!=NULL) delete lwpnscripts[i]; |
| 12960 | 19712 | } | |
| 12961 | |||
| 12962 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<NUMSCRIPTWEAPONS; i++) |
| 12963 | { | ||
| 12964 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 19712 times.
|
19712 | if(ewpnscripts[i]!=NULL) delete ewpnscripts[i]; |
| 12965 | 19712 | } | |
| 12966 | |||
| 12967 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<NUMSCRIPTSDMAP; i++) |
| 12968 | { | ||
| 12969 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 19712 times.
|
19712 | if(dmapscripts[i]!=NULL) delete dmapscripts[i]; |
| 12970 | 19712 | } | |
| 12971 | |||
| 12972 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<NUMSCRIPTSITEMSPRITE; i++) |
| 12973 | { | ||
| 12974 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 19712 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 19712 times.
|
19712 | if(itemspritescripts[i]!=NULL) delete itemspritescripts[i]; |
| 12975 | 19712 | } | |
| 12976 | |||
| 12977 |
2/2✓ Branch 0 taken 39424 times.
✓ Branch 1 taken 77 times.
|
39501 | for(int32_t i=0; i<NUMSCRIPTSCOMBODATA; i++) |
| 12978 | { | ||
| 12979 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 39424 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 39424 times.
|
39424 | if(comboscripts[i]!=NULL) delete comboscripts[i]; |
| 12980 | 39424 | } | |
| 12981 | |||
| 12982 |
2/2✓ Branch 0 taken 39424 times.
✓ Branch 1 taken 77 times.
|
39501 | for(int32_t i=0; i<NUMSCRIPTSGENERIC; i++) |
| 12983 | { | ||
| 12984 |
3/4✓ Branch 0 taken 7168 times.
✓ Branch 1 taken 32256 times.
✓ Branch 2 taken 32256 times.
✗ Branch 3 not taken.
|
39424 | if(genericscripts[i]!=NULL) delete genericscripts[i]; |
| 12985 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | genericscripts[i] = new script_data(); |
| 12986 | 39424 | } | |
| 12987 | |||
| 12988 |
2/2✓ Branch 0 taken 39424 times.
✓ Branch 1 taken 77 times.
|
39501 | for(int32_t i=0; i<NUMSCRIPTFFC; i++) |
| 12989 | { | ||
| 12990 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | ffscripts[i] = new script_data(); |
| 12991 | 39424 | } | |
| 12992 | |||
| 12993 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<NUMSCRIPTITEM; i++) |
| 12994 | { | ||
| 12995 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | itemscripts[i] = new script_data(); |
| 12996 | 19712 | } | |
| 12997 | |||
| 12998 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<NUMSCRIPTGUYS; i++) |
| 12999 | { | ||
| 13000 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | guyscripts[i] = new script_data(); |
| 13001 | 19712 | } | |
| 13002 | |||
| 13003 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<NUMSCRIPTWEAPONS; i++) |
| 13004 | { | ||
| 13005 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | wpnscripts[i] = new script_data(); |
| 13006 | 19712 | } | |
| 13007 | |||
| 13008 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<NUMSCRIPTSCREEN; i++) |
| 13009 | { | ||
| 13010 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | screenscripts[i] = new script_data(); |
| 13011 | 19712 | } | |
| 13012 | |||
| 13013 |
2/2✓ Branch 0 taken 616 times.
✓ Branch 1 taken 77 times.
|
693 | for(int32_t i=0; i<NUMSCRIPTGLOBAL; i++) |
| 13014 | { | ||
| 13015 |
1/2✓ Branch 0 taken 616 times.
✗ Branch 1 not taken.
|
616 | globalscripts[i] = new script_data(); |
| 13016 | 616 | } | |
| 13017 | |||
| 13018 |
2/2✓ Branch 0 taken 385 times.
✓ Branch 1 taken 77 times.
|
462 | for(int32_t i=0; i<NUMSCRIPTPLAYER; i++) |
| 13019 | { | ||
| 13020 |
1/2✓ Branch 0 taken 385 times.
✗ Branch 1 not taken.
|
385 | playerscripts[i] = new script_data(); |
| 13021 | 385 | } | |
| 13022 | |||
| 13023 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<NUMSCRIPTWEAPONS; i++) |
| 13024 | { | ||
| 13025 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | lwpnscripts[i] = new script_data(); |
| 13026 | 19712 | } | |
| 13027 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<NUMSCRIPTWEAPONS; i++) |
| 13028 | { | ||
| 13029 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | ewpnscripts[i] = new script_data(); |
| 13030 | 19712 | } | |
| 13031 | |||
| 13032 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<NUMSCRIPTSDMAP; i++) |
| 13033 | { | ||
| 13034 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | dmapscripts[i] = new script_data(); |
| 13035 | 19712 | } | |
| 13036 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<NUMSCRIPTSITEMSPRITE; i++) |
| 13037 | { | ||
| 13038 |
1/2✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
|
19712 | itemspritescripts[i] = new script_data(); |
| 13039 | 19712 | } | |
| 13040 |
2/2✓ Branch 0 taken 39424 times.
✓ Branch 1 taken 77 times.
|
39501 | for(int32_t i=0; i<NUMSCRIPTSCOMBODATA; i++) |
| 13041 | { | ||
| 13042 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | comboscripts[i] = new script_data(); |
| 13043 | 39424 | } | |
| 13044 | 77 | } | |
| 13045 | |||
| 13046 | extern script_command command_list[]; | ||
| 13047 | 135243 | int32_t read_one_ffscript(PACKFILE *f, zquestheader *, bool keepdata, int32_t , word s_version, word , script_data **script, word zmeta_version) | |
| 13048 | { | ||
| 13049 | //Please also update loadquest() when modifying this method -DD | ||
| 13050 | 135243 | char b33[34] = {0}; | |
| 13051 | 135243 | b33[33] = 0; | |
| 13052 | 135243 | ffscript temp_script; | |
| 13053 | 135243 | int32_t num_commands=1000; | |
| 13054 | |||
| 13055 |
1/2✓ Branch 0 taken 135243 times.
✗ Branch 1 not taken.
|
135243 | if(s_version>=2) |
| 13056 | { | ||
| 13057 |
2/4✓ Branch 0 taken 135243 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 135243 times.
✗ Branch 3 not taken.
|
135243 | if(!p_igetl(&num_commands,f,true)) |
| 13058 | { | ||
| 13059 | ✗ | return qe_invalid; | |
| 13060 | } | ||
| 13061 | 135243 | } | |
| 13062 | |||
| 13063 |
1/2✓ Branch 0 taken 135243 times.
✗ Branch 1 not taken.
|
135243 | if(keepdata) |
| 13064 | { | ||
| 13065 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 135243 times.
|
135243 | if((*script) != NULL) //Surely we want to do this regardless of keepdata? //No, we don't -V |
| 13066 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 135243 times.
|
135243 | delete (*script); |
| 13067 |
2/4✓ Branch 0 taken 135243 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 135243 times.
✗ Branch 3 not taken.
|
135243 | (*script) = new script_data(num_commands); |
| 13068 | 135243 | } | |
| 13069 |
2/2✓ Branch 0 taken 28776 times.
✓ Branch 1 taken 106467 times.
|
135243 | if(s_version >= 16) |
| 13070 | { | ||
| 13071 |
1/2✓ Branch 0 taken 28776 times.
✗ Branch 1 not taken.
|
28776 | zasm_meta temp_meta; |
| 13072 | |||
| 13073 |
2/4✓ Branch 0 taken 28776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28776 times.
✗ Branch 3 not taken.
|
28776 | if(!p_igetw(&(temp_meta.zasm_v),f,true)) |
| 13074 | { | ||
| 13075 | ✗ | return qe_invalid; | |
| 13076 | } | ||
| 13077 | |||
| 13078 |
2/4✓ Branch 0 taken 28776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28776 times.
✗ Branch 3 not taken.
|
28776 | if(!p_igetw(&(temp_meta.meta_v),f,true)) |
| 13079 | { | ||
| 13080 | ✗ | return qe_invalid; | |
| 13081 | } | ||
| 13082 | |||
| 13083 |
2/4✓ Branch 0 taken 28776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28776 times.
✗ Branch 3 not taken.
|
28776 | if(!p_igetw(&(temp_meta.ffscript_v),f,true)) |
| 13084 | { | ||
| 13085 | ✗ | return qe_invalid; | |
| 13086 | } | ||
| 13087 | |||
| 13088 |
2/4✓ Branch 0 taken 28776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28776 times.
✗ Branch 3 not taken.
|
28776 | if(!p_getc(&(temp_meta.script_type),f,true)) |
| 13089 | { | ||
| 13090 | ✗ | return qe_invalid; | |
| 13091 | } | ||
| 13092 | |||
| 13093 |
2/2✓ Branch 0 taken 230208 times.
✓ Branch 1 taken 28776 times.
|
258984 | for(int32_t q = 0; q < 8; ++q) |
| 13094 | { | ||
| 13095 |
2/2✓ Branch 0 taken 115104 times.
✓ Branch 1 taken 115104 times.
|
230208 | if(zmeta_version < 3) |
| 13096 | { | ||
| 13097 |
2/2✓ Branch 0 taken 115104 times.
✓ Branch 1 taken 3798432 times.
|
3913536 | for(int32_t c = 0; c < 33; ++c) |
| 13098 | { | ||
| 13099 |
2/4✓ Branch 0 taken 3798432 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3798432 times.
✗ Branch 3 not taken.
|
3798432 | if(!p_getc(&(b33[c]),f,true)) |
| 13100 | { | ||
| 13101 | ✗ | return qe_invalid; | |
| 13102 | } | ||
| 13103 | 3798432 | } | |
| 13104 |
1/2✓ Branch 0 taken 115104 times.
✗ Branch 1 not taken.
|
115104 | temp_meta.run_idens[q].assign(b33); |
| 13105 | 115104 | } | |
| 13106 | else | ||
| 13107 | { | ||
| 13108 |
2/4✓ Branch 0 taken 115104 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 115104 times.
✗ Branch 3 not taken.
|
115104 | if(!p_getcstr(&temp_meta.run_idens[q],f,true)) |
| 13109 | { | ||
| 13110 | ✗ | return qe_invalid; | |
| 13111 | } | ||
| 13112 | } | ||
| 13113 | 230208 | } | |
| 13114 | |||
| 13115 |
2/2✓ Branch 0 taken 28776 times.
✓ Branch 1 taken 230208 times.
|
258984 | for(int32_t q = 0; q < 8; ++q) |
| 13116 | { | ||
| 13117 |
2/4✓ Branch 0 taken 230208 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 230208 times.
✗ Branch 3 not taken.
|
230208 | if(!p_getc(&(temp_meta.run_types[q]),f,true)) |
| 13118 | { | ||
| 13119 | ✗ | return qe_invalid; | |
| 13120 | } | ||
| 13121 | 230208 | } | |
| 13122 | |||
| 13123 |
2/4✓ Branch 0 taken 28776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28776 times.
✗ Branch 3 not taken.
|
28776 | if(!p_getc(&(temp_meta.flags),f,true)) |
| 13124 | { | ||
| 13125 | ✗ | return qe_invalid; | |
| 13126 | } | ||
| 13127 | |||
| 13128 |
2/4✓ Branch 0 taken 28776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28776 times.
✗ Branch 3 not taken.
|
28776 | if(!p_igetw(&(temp_meta.compiler_v1),f,true)) |
| 13129 | { | ||
| 13130 | ✗ | return qe_invalid; | |
| 13131 | } | ||
| 13132 | |||
| 13133 |
2/4✓ Branch 0 taken 28776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28776 times.
✗ Branch 3 not taken.
|
28776 | if(!p_igetw(&(temp_meta.compiler_v2),f,true)) |
| 13134 | { | ||
| 13135 | ✗ | return qe_invalid; | |
| 13136 | } | ||
| 13137 | |||
| 13138 |
2/4✓ Branch 0 taken 28776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28776 times.
✗ Branch 3 not taken.
|
28776 | if(!p_igetw(&(temp_meta.compiler_v3),f,true)) |
| 13139 | { | ||
| 13140 | ✗ | return qe_invalid; | |
| 13141 | } | ||
| 13142 | |||
| 13143 |
2/4✓ Branch 0 taken 28776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28776 times.
✗ Branch 3 not taken.
|
28776 | if(!p_igetw(&(temp_meta.compiler_v4),f,true)) |
| 13144 | { | ||
| 13145 | ✗ | return qe_invalid; | |
| 13146 | } | ||
| 13147 | |||
| 13148 |
2/2✓ Branch 0 taken 14388 times.
✓ Branch 1 taken 14388 times.
|
28776 | if(zmeta_version == 2) |
| 13149 | { | ||
| 13150 |
2/2✓ Branch 0 taken 14388 times.
✓ Branch 1 taken 474804 times.
|
489192 | for(int32_t c = 0; c < 33; ++c) |
| 13151 | { | ||
| 13152 |
2/4✓ Branch 0 taken 474804 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 474804 times.
✗ Branch 3 not taken.
|
474804 | if(!p_getc(&b33[c],f,true)) |
| 13153 | { | ||
| 13154 | ✗ | return qe_invalid; | |
| 13155 | } | ||
| 13156 | 474804 | } | |
| 13157 |
1/2✓ Branch 0 taken 14388 times.
✗ Branch 1 not taken.
|
14388 | temp_meta.script_name.assign(b33); |
| 13158 | |||
| 13159 |
2/2✓ Branch 0 taken 14388 times.
✓ Branch 1 taken 474804 times.
|
489192 | for(int32_t c = 0; c < 33; ++c) |
| 13160 | { | ||
| 13161 |
2/4✓ Branch 0 taken 474804 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 474804 times.
✗ Branch 3 not taken.
|
474804 | if(!p_getc(&b33[c],f,true)) |
| 13162 | { | ||
| 13163 | ✗ | return qe_invalid; | |
| 13164 | } | ||
| 13165 | 474804 | } | |
| 13166 |
1/2✓ Branch 0 taken 14388 times.
✗ Branch 1 not taken.
|
14388 | temp_meta.author.assign(b33); |
| 13167 | 14388 | } | |
| 13168 |
1/2✓ Branch 0 taken 14388 times.
✗ Branch 1 not taken.
|
14388 | else if(zmeta_version > 2) |
| 13169 | { | ||
| 13170 |
2/4✓ Branch 0 taken 14388 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14388 times.
✗ Branch 3 not taken.
|
14388 | if(!p_getcstr(&temp_meta.script_name,f,true)) |
| 13171 | ✗ | return qe_invalid; | |
| 13172 |
2/4✓ Branch 0 taken 14388 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14388 times.
✗ Branch 3 not taken.
|
14388 | if(!p_getcstr(&temp_meta.author,f,true)) |
| 13173 | ✗ | return qe_invalid; | |
| 13174 | 14388 | auto num_meta_attrib = (zmeta_version < 5 ? 4 : 10); | |
| 13175 |
2/2✓ Branch 0 taken 143880 times.
✓ Branch 1 taken 14388 times.
|
158268 | for(auto q = 0; q < num_meta_attrib; ++q) |
| 13176 | { | ||
| 13177 |
2/4✓ Branch 0 taken 143880 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 143880 times.
✗ Branch 3 not taken.
|
143880 | if(!p_getcstr(&temp_meta.attributes[q],f,true)) |
| 13178 | ✗ | return qe_invalid; | |
| 13179 |
2/4✓ Branch 0 taken 143880 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 143880 times.
✗ Branch 3 not taken.
|
143880 | if(!p_getwstr(&temp_meta.attributes_help[q],f,true)) |
| 13180 | ✗ | return qe_invalid; | |
| 13181 | 143880 | } | |
| 13182 |
2/2✓ Branch 0 taken 115104 times.
✓ Branch 1 taken 14388 times.
|
129492 | for(auto q = 0; q < 8; ++q) |
| 13183 | { | ||
| 13184 |
2/4✓ Branch 0 taken 115104 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 115104 times.
✗ Branch 3 not taken.
|
115104 | if(!p_getcstr(&temp_meta.attribytes[q],f,true)) |
| 13185 | ✗ | return qe_invalid; | |
| 13186 |
2/4✓ Branch 0 taken 115104 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 115104 times.
✗ Branch 3 not taken.
|
115104 | if(!p_getwstr(&temp_meta.attribytes_help[q],f,true)) |
| 13187 | ✗ | return qe_invalid; | |
| 13188 | 115104 | } | |
| 13189 |
2/2✓ Branch 0 taken 115104 times.
✓ Branch 1 taken 14388 times.
|
129492 | for(auto q = 0; q < 8; ++q) |
| 13190 | { | ||
| 13191 |
2/4✓ Branch 0 taken 115104 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 115104 times.
✗ Branch 3 not taken.
|
115104 | if(!p_getcstr(&temp_meta.attrishorts[q],f,true)) |
| 13192 | ✗ | return qe_invalid; | |
| 13193 |
2/4✓ Branch 0 taken 115104 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 115104 times.
✗ Branch 3 not taken.
|
115104 | if(!p_getwstr(&temp_meta.attrishorts_help[q],f,true)) |
| 13194 | ✗ | return qe_invalid; | |
| 13195 | 115104 | } | |
| 13196 |
2/2✓ Branch 0 taken 230208 times.
✓ Branch 1 taken 14388 times.
|
244596 | for(auto q = 0; q < 16; ++q) |
| 13197 | { | ||
| 13198 |
2/4✓ Branch 0 taken 230208 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 230208 times.
✗ Branch 3 not taken.
|
230208 | if(!p_getcstr(&temp_meta.usrflags[q],f,true)) |
| 13199 | ✗ | return qe_invalid; | |
| 13200 |
2/4✓ Branch 0 taken 230208 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 230208 times.
✗ Branch 3 not taken.
|
230208 | if(!p_getwstr(&temp_meta.usrflags_help[q],f,true)) |
| 13201 | ✗ | return qe_invalid; | |
| 13202 | 230208 | } | |
| 13203 | 14388 | } | |
| 13204 |
2/2✓ Branch 0 taken 14388 times.
✓ Branch 1 taken 14388 times.
|
28776 | if(zmeta_version > 3) |
| 13205 | { | ||
| 13206 |
2/2✓ Branch 0 taken 115104 times.
✓ Branch 1 taken 14388 times.
|
129492 | for(auto q = 0; q < 8; ++q) |
| 13207 | { | ||
| 13208 |
2/4✓ Branch 0 taken 115104 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 115104 times.
✗ Branch 3 not taken.
|
115104 | if(!p_getcstr(&temp_meta.initd[q],f,true)) |
| 13209 | ✗ | return qe_invalid; | |
| 13210 |
2/4✓ Branch 0 taken 115104 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 115104 times.
✗ Branch 3 not taken.
|
115104 | if(!p_getwstr(&temp_meta.initd_help[q],f,true)) |
| 13211 | ✗ | return qe_invalid; | |
| 13212 | 115104 | } | |
| 13213 |
2/2✓ Branch 0 taken 115104 times.
✓ Branch 1 taken 14388 times.
|
129492 | for(auto q = 0; q < 8; ++q) |
| 13214 | { | ||
| 13215 |
2/4✓ Branch 0 taken 115104 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 115104 times.
✗ Branch 3 not taken.
|
115104 | if(!p_getc(&temp_meta.initd_type[q],f,true)) |
| 13216 | ✗ | return qe_invalid; | |
| 13217 | 115104 | } | |
| 13218 | 14388 | } | |
| 13219 | else | ||
| 13220 | { | ||
| 13221 |
2/2✓ Branch 0 taken 115104 times.
✓ Branch 1 taken 14388 times.
|
129492 | for(auto q = 0; q < 8; ++q) |
| 13222 | { | ||
| 13223 |
1/2✓ Branch 0 taken 115104 times.
✗ Branch 1 not taken.
|
115104 | temp_meta.initd[q] = temp_meta.run_idens[q]; |
| 13224 | 115104 | } | |
| 13225 | } | ||
| 13226 | |||
| 13227 |
1/2✓ Branch 0 taken 28776 times.
✗ Branch 1 not taken.
|
28776 | if(keepdata) |
| 13228 |
1/2✓ Branch 0 taken 28776 times.
✗ Branch 1 not taken.
|
28776 | (*script)->meta = temp_meta; |
| 13229 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28776 times.
|
28776 | } |
| 13230 | |||
| 13231 |
1/2✓ Branch 0 taken 135243 times.
✗ Branch 1 not taken.
|
135243 | temp_script.clear(); |
| 13232 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6432581 times.
|
6432581 | for(int32_t j=0; j<num_commands; j++) |
| 13233 | { | ||
| 13234 |
2/4✓ Branch 0 taken 6432581 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6432581 times.
✗ Branch 3 not taken.
|
6432581 | if(!p_igetw(&(temp_script.command),f,true)) |
| 13235 | { | ||
| 13236 | ✗ | return qe_invalid; | |
| 13237 | } | ||
| 13238 | |||
| 13239 |
2/2✓ Branch 0 taken 6297338 times.
✓ Branch 1 taken 135243 times.
|
6432581 | if(temp_script.command == 0xFFFF) |
| 13240 | { | ||
| 13241 |
1/2✓ Branch 0 taken 135243 times.
✗ Branch 1 not taken.
|
135243 | if(keepdata) |
| 13242 |
1/2✓ Branch 0 taken 135243 times.
✗ Branch 1 not taken.
|
135243 | (*script)->zasm[j].clear(); |
| 13243 | 135243 | break; | |
| 13244 | } | ||
| 13245 | else | ||
| 13246 | { | ||
| 13247 |
2/4✓ Branch 0 taken 6297338 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6297338 times.
✗ Branch 3 not taken.
|
6297338 | if(!p_igetl(&(temp_script.arg1),f,keepdata)) |
| 13248 | { | ||
| 13249 | ✗ | return qe_invalid; | |
| 13250 | } | ||
| 13251 | |||
| 13252 |
2/4✓ Branch 0 taken 6297338 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6297338 times.
✗ Branch 3 not taken.
|
6297338 | if(!p_igetl(&(temp_script.arg2),f,keepdata)) |
| 13253 | { | ||
| 13254 | ✗ | return qe_invalid; | |
| 13255 | } | ||
| 13256 | |||
| 13257 |
2/2✓ Branch 0 taken 189127 times.
✓ Branch 1 taken 6108211 times.
|
6297338 | if(s_version >= 21) |
| 13258 | { | ||
| 13259 | 189127 | uint32_t sz = 0; | |
| 13260 |
2/4✓ Branch 0 taken 189127 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 189127 times.
✗ Branch 3 not taken.
|
189127 | if(!p_igetl(&sz,f,keepdata)) |
| 13261 | { | ||
| 13262 | ✗ | return qe_invalid; | |
| 13263 | } | ||
| 13264 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 188984 times.
|
189127 | if(sz) //string found |
| 13265 | { | ||
| 13266 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | temp_script.strptr = new std::string(); |
| 13267 | char dummy; | ||
| 13268 |
2/2✓ Branch 0 taken 3871 times.
✓ Branch 1 taken 143 times.
|
4014 | for(size_t q = 0; q < sz; ++q) |
| 13269 | { | ||
| 13270 |
2/4✓ Branch 0 taken 3871 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3871 times.
✗ Branch 3 not taken.
|
3871 | if(!p_getc(&dummy,f,keepdata)) |
| 13271 | { | ||
| 13272 | ✗ | return qe_invalid; | |
| 13273 | } | ||
| 13274 |
1/2✓ Branch 0 taken 3871 times.
✗ Branch 1 not taken.
|
3871 | temp_script.strptr->push_back(dummy); |
| 13275 | 3871 | } | |
| 13276 | 143 | } | |
| 13277 |
2/4✓ Branch 0 taken 189127 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 189127 times.
✗ Branch 3 not taken.
|
189127 | if(!p_igetl(&sz,f,keepdata)) |
| 13278 | { | ||
| 13279 | ✗ | return qe_invalid; | |
| 13280 | } | ||
| 13281 |
2/2✓ Branch 0 taken 79 times.
✓ Branch 1 taken 189048 times.
|
189127 | if(sz) //vector found |
| 13282 | { | ||
| 13283 |
1/2✓ Branch 0 taken 79 times.
✗ Branch 1 not taken.
|
79 | temp_script.vecptr = new std::vector<int32_t>(); |
| 13284 | int32_t dummy; | ||
| 13285 |
2/2✓ Branch 0 taken 1135 times.
✓ Branch 1 taken 79 times.
|
1214 | for(size_t q = 0; q < sz; ++q) |
| 13286 | { | ||
| 13287 |
2/4✓ Branch 0 taken 1135 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1135 times.
✗ Branch 3 not taken.
|
1135 | if(!p_igetl(&dummy,f,keepdata)) |
| 13288 | { | ||
| 13289 | ✗ | return qe_invalid; | |
| 13290 | } | ||
| 13291 |
1/2✓ Branch 0 taken 1135 times.
✗ Branch 1 not taken.
|
1135 | temp_script.vecptr->push_back(dummy); |
| 13292 | 1135 | } | |
| 13293 | 79 | } | |
| 13294 | 189127 | } | |
| 13295 | |||
| 13296 |
1/2✓ Branch 0 taken 6297338 times.
✗ Branch 1 not taken.
|
6297338 | if(keepdata) |
| 13297 | { | ||
| 13298 |
1/2✓ Branch 0 taken 6297338 times.
✗ Branch 1 not taken.
|
6297338 | temp_script.give((*script)->zasm[j]); |
| 13299 | 6297338 | } | |
| 13300 | } | ||
| 13301 |
1/2✓ Branch 0 taken 6297338 times.
✗ Branch 1 not taken.
|
6297338 | temp_script.clear(); |
| 13302 | 6297338 | } | |
| 13303 | |||
| 13304 | 135243 | return 0; | |
| 13305 | 135243 | } | |
| 13306 | |||
| 13307 | extern SAMPLE customsfxdata[WAV_COUNT]; | ||
| 13308 | extern uint8_t customsfxflag[WAV_COUNT>>3]; | ||
| 13309 | extern int32_t sfxdat; | ||
| 13310 | extern DATAFILE *sfxdata; | ||
| 13311 | const char *old_sfx_string[Z35] = | ||
| 13312 | { | ||
| 13313 | "Arrow", "Sword beam", "Bomb blast", "Boomerang", "Subscreen cursor", | ||
| 13314 | "Shield is hit", "Item chime", "Roar (Dodongo, Gohma)", "Shutter", "Enemy dies", | ||
| 13315 | "Enemy is hit", "Low hearts warning", "Fire", "Ganon's fanfare", "Boss is hit", "Hammer", | ||
| 13316 | "Hookshot", "Message", "Player is hit", "Item fanfare", "Bomb placed", "Item pickup", | ||
| 13317 | "Refill", "Roar (Aquamentus, Gleeok, Ganon)", "Item pickup 2", "Ocean ambience", | ||
| 13318 | "Secret chime", "Player dies", "Stairs", "Sword", "Roar (Manhandla, Digdogger, Patra)", | ||
| 13319 | "Wand magic", "Whistle", "Zelda's fanfare", "Charging weapon", "Charging weapon 2", | ||
| 13320 | "Din's Fire", "Enemy falls from ceiling", "Farore's Wind", "Fireball", "Tall Grass slashed", | ||
| 13321 | "Pound pounded", "Hover Boots", "Ice magic", "Jump", "Lens of Truth off", "Lens of Truth on", | ||
| 13322 | "Nayru's Love shield", "Nayru's Love shield 2", "Push block", "Rock", "Spell rocket down", | ||
| 13323 | "Spell rocket up", "Sword spin attack", "Splash", "Summon magic", "Sword tapping", | ||
| 13324 | "Sword tapping (secret)", "Whistle whirlwind", "Cane of Byrna orbit" | ||
| 13325 | }; | ||
| 13326 | char *sfx_string[WAV_COUNT]; | ||
| 13327 | |||
| 13328 | 77 | int32_t readsfx(PACKFILE *f, zquestheader *Header, bool keepdata) | |
| 13329 | { | ||
| 13330 | //these are here to bypass compiler warnings about unused arguments | ||
| 13331 | 77 | Header=Header; | |
| 13332 | |||
| 13333 | int32_t dummy; | ||
| 13334 | 77 | word s_version=0, s_cversion=0; | |
| 13335 | //int32_t ret; | ||
| 13336 | SAMPLE temp_sample; | ||
| 13337 | 77 | temp_sample.loop_start=0; | |
| 13338 | 77 | temp_sample.loop_end=0; | |
| 13339 | 77 | temp_sample.param=0; | |
| 13340 | |||
| 13341 | //section version info | ||
| 13342 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(!p_igetw(&s_version,f,true)) |
| 13343 | { | ||
| 13344 | ✗ | return qe_invalid; | |
| 13345 | } | ||
| 13346 | |||
| 13347 | 77 | FFCore.quest_format[vSFX] = s_version; | |
| 13348 | |||
| 13349 | //al_trace("SFX version %d\n", s_version); | ||
| 13350 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_cversion,f,true)) |
| 13351 | { | ||
| 13352 | ✗ | return qe_invalid; | |
| 13353 | } | ||
| 13354 | |||
| 13355 | //section size | ||
| 13356 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&dummy,f,true)) |
| 13357 | { | ||
| 13358 | ✗ | return qe_invalid; | |
| 13359 | } | ||
| 13360 | |||
| 13361 | /* HIGHLY UNORTHODOX UPDATING THING, by L | ||
| 13362 | * This fixes quests made before revision 411 (such as the 'Lost Isle Build'), | ||
| 13363 | * where the meaning of GOTOLESS changed. It also coincided with V_SFX | ||
| 13364 | * changing from 1 to 2. | ||
| 13365 | */ | ||
| 13366 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
77 | if(s_version < 2 && keepdata) |
| 13367 | ✗ | set_bit(quest_rules,qr_GOTOLESSNOTEQUAL,1); | |
| 13368 | |||
| 13369 | /* End highly unorthodox updating thing */ | ||
| 13370 | |||
| 13371 | 77 | int32_t wavcount = WAV_COUNT; | |
| 13372 | |||
| 13373 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version < 6) |
| 13374 | ✗ | wavcount = 128; | |
| 13375 | |||
| 13376 | uint8_t tempflag[WAV_COUNT>>3]; | ||
| 13377 | |||
| 13378 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(s_version < 4) |
| 13379 | { | ||
| 13380 | ✗ | memset(tempflag, 0xFF, WAV_COUNT>>3); | |
| 13381 | } | ||
| 13382 | else | ||
| 13383 | { | ||
| 13384 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version < 6) |
| 13385 | ✗ | memset(tempflag, 0, WAV_COUNT>>3); | |
| 13386 | |||
| 13387 |
2/2✓ Branch 0 taken 2464 times.
✓ Branch 1 taken 77 times.
|
2541 | for(int32_t i=0; i<(wavcount>>3); i++) |
| 13388 | { | ||
| 13389 | 2464 | p_getc(&tempflag[i], f, true); | |
| 13390 | 2464 | } | |
| 13391 | |||
| 13392 | } | ||
| 13393 | |||
| 13394 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version>4) |
| 13395 | { | ||
| 13396 |
2/2✓ Branch 0 taken 19635 times.
✓ Branch 1 taken 77 times.
|
19712 | for(int32_t i=1; i<WAV_COUNT; i++) |
| 13397 | { | ||
| 13398 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19635 times.
|
19635 | if(keepdata) |
| 13399 | { | ||
| 13400 | 19635 | sprintf(sfx_string[i],"s%03d",i); | |
| 13401 | |||
| 13402 |
2/2✓ Branch 0 taken 15015 times.
✓ Branch 1 taken 4620 times.
|
19635 | if((i<Z35)) |
| 13403 | 4620 | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13404 | 19635 | } | |
| 13405 | |||
| 13406 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19635 times.
|
19635 | if(i>=wavcount) |
| 13407 | ✗ | continue; | |
| 13408 |
2/2✓ Branch 0 taken 810 times.
✓ Branch 1 taken 18825 times.
|
19635 | if(get_bit(tempflag, i-1)) |
| 13409 | { | ||
| 13410 | char tempname[36]; | ||
| 13411 | |||
| 13412 |
1/2✓ Branch 0 taken 810 times.
✗ Branch 1 not taken.
|
810 | if(!pfread(tempname, 36, f, keepdata)) |
| 13413 | { | ||
| 13414 | ✗ | return qe_invalid; | |
| 13415 | } | ||
| 13416 | |||
| 13417 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 810 times.
|
810 | if(keepdata) |
| 13418 | { | ||
| 13419 | 810 | strcpy(sfx_string[i], tempname); | |
| 13420 | 810 | sfx_string[i][35] = 0; //Force NULL Termination | |
| 13421 | 810 | } | |
| 13422 | 810 | } | |
| 13423 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18825 times.
|
18825 | else if(keepdata) |
| 13424 | { | ||
| 13425 | 18825 | sprintf(sfx_string[i],"s%03d",i); | |
| 13426 | |||
| 13427 |
2/2✓ Branch 0 taken 14700 times.
✓ Branch 1 taken 4125 times.
|
18825 | if(i<Z35) |
| 13428 | 4125 | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13429 | 18825 | sfx_string[i][35] = 0; //Force NULL Termination | |
| 13430 | 18825 | } | |
| 13431 | 19635 | } | |
| 13432 | 77 | } | |
| 13433 | else | ||
| 13434 | { | ||
| 13435 | ✗ | if(keepdata) | |
| 13436 | { | ||
| 13437 | ✗ | for(int32_t i=1; i<WAV_COUNT; i++) | |
| 13438 | { | ||
| 13439 | ✗ | sprintf(sfx_string[i],"s%03d",i); | |
| 13440 | |||
| 13441 | ✗ | if(i<Z35) | |
| 13442 | ✗ | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13443 | } | ||
| 13444 | } | ||
| 13445 | } | ||
| 13446 | |||
| 13447 | //finally... section data | ||
| 13448 |
2/2✓ Branch 0 taken 19635 times.
✓ Branch 1 taken 77 times.
|
19712 | for(int32_t i=1; i<wavcount; i++) |
| 13449 | { | ||
| 13450 |
2/2✓ Branch 0 taken 810 times.
✓ Branch 1 taken 18825 times.
|
19635 | if(get_bit(tempflag, i-1)) |
| 13451 | { | ||
| 13452 | |||
| 13453 |
1/2✓ Branch 0 taken 810 times.
✗ Branch 1 not taken.
|
810 | if(!p_igetl(&dummy,f,true)) |
| 13454 | { | ||
| 13455 | ✗ | return qe_invalid; | |
| 13456 | } | ||
| 13457 | |||
| 13458 | 810 | (temp_sample.bits) = dummy; | |
| 13459 | |||
| 13460 |
1/2✓ Branch 0 taken 810 times.
✗ Branch 1 not taken.
|
810 | if(!p_igetl(&dummy,f,true)) |
| 13461 | { | ||
| 13462 | ✗ | return qe_invalid; | |
| 13463 | } | ||
| 13464 | |||
| 13465 | 810 | (temp_sample.stereo) = dummy; | |
| 13466 | |||
| 13467 |
1/2✓ Branch 0 taken 810 times.
✗ Branch 1 not taken.
|
810 | if(!p_igetl(&dummy,f,keepdata)) |
| 13468 | { | ||
| 13469 | ✗ | return qe_invalid; | |
| 13470 | } | ||
| 13471 | |||
| 13472 | 810 | (temp_sample.freq) = dummy; | |
| 13473 | |||
| 13474 |
1/2✓ Branch 0 taken 810 times.
✗ Branch 1 not taken.
|
810 | if(!p_igetl(&dummy,f,keepdata)) |
| 13475 | { | ||
| 13476 | ✗ | return qe_invalid; | |
| 13477 | } | ||
| 13478 | |||
| 13479 | 810 | (temp_sample.priority) = dummy; | |
| 13480 | |||
| 13481 |
1/2✓ Branch 0 taken 810 times.
✗ Branch 1 not taken.
|
810 | if(!p_igetl(&(temp_sample.len),f,true)) |
| 13482 | { | ||
| 13483 | ✗ | return qe_invalid; | |
| 13484 | } | ||
| 13485 | |||
| 13486 |
1/2✓ Branch 0 taken 810 times.
✗ Branch 1 not taken.
|
810 | if(!p_igetl(&(temp_sample.loop_start),f,keepdata)) |
| 13487 | { | ||
| 13488 | ✗ | return qe_invalid; | |
| 13489 | } | ||
| 13490 | |||
| 13491 |
1/2✓ Branch 0 taken 810 times.
✗ Branch 1 not taken.
|
810 | if(!p_igetl(&(temp_sample.loop_end),f,keepdata)) |
| 13492 | { | ||
| 13493 | ✗ | return qe_invalid; | |
| 13494 | } | ||
| 13495 | |||
| 13496 |
1/2✓ Branch 0 taken 810 times.
✗ Branch 1 not taken.
|
810 | if(!p_igetl(&(temp_sample.param),f,keepdata)) |
| 13497 | { | ||
| 13498 | ✗ | return qe_invalid; | |
| 13499 | } | ||
| 13500 | |||
| 13501 | // al_trace("F%i: L%i\n",i,temp_sample.len); | ||
| 13502 | // temp_sample.data = new byte[(temp_sample.bits==8?1:2)*temp_sample.len]; | ||
| 13503 | 810 | int32_t len = (temp_sample.bits==8?1:2)*(temp_sample.stereo==0?1:2)*temp_sample.len; | |
| 13504 | 810 | temp_sample.data = calloc(len,1); | |
| 13505 | |||
| 13506 |
1/2✓ Branch 0 taken 810 times.
✗ Branch 1 not taken.
|
810 | if(s_version < 3) |
| 13507 | ✗ | len = (temp_sample.bits==8?1:2)*temp_sample.len; | |
| 13508 | |||
| 13509 | //old-style, non-portable loading (Bad Allegro! Bad!!) -DD | ||
| 13510 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 810 times.
|
810 | if(s_version < 2) |
| 13511 | { | ||
| 13512 | ✗ | if(!pfread(temp_sample.data, len,f,keepdata)) | |
| 13513 | { | ||
| 13514 | ✗ | return qe_invalid; | |
| 13515 | } | ||
| 13516 | } | ||
| 13517 | else | ||
| 13518 | { | ||
| 13519 | //re-endianfy the data | ||
| 13520 | 810 | int32_t wordstoread = len / sizeof(word); | |
| 13521 | |||
| 13522 |
2/2✓ Branch 0 taken 24519733 times.
✓ Branch 1 taken 810 times.
|
24520543 | for(int32_t j=0; j<wordstoread; j++) |
| 13523 | { | ||
| 13524 | word temp; | ||
| 13525 | |||
| 13526 |
1/2✓ Branch 0 taken 24519733 times.
✗ Branch 1 not taken.
|
24519733 | if(!p_igetw(&temp, f, keepdata)) |
| 13527 | { | ||
| 13528 | ✗ | return qe_invalid; | |
| 13529 | } | ||
| 13530 | |||
| 13531 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24519733 times.
|
24519733 | if(keepdata) |
| 13532 | 24519733 | ((word *)temp_sample.data)[j] = temp; | |
| 13533 | 24519733 | } | |
| 13534 | } | ||
| 13535 | 810 | } | |
| 13536 |
2/2✓ Branch 0 taken 4125 times.
✓ Branch 1 taken 14700 times.
|
18825 | else if(i < Z35) |
| 13537 | { | ||
| 13538 | 4125 | SAMPLE* datsamp = (SAMPLE*)(sfxdata[i].dat); | |
| 13539 | 4125 | memcpy(&temp_sample, datsamp, sizeof(SAMPLE)); | |
| 13540 | 4125 | set_bit(tempflag, i-1, 1); | |
| 13541 | 4125 | int32_t len = (temp_sample.bits==8?1:2)*(temp_sample.stereo==0?1:2)*temp_sample.len; | |
| 13542 | 4125 | temp_sample.data = calloc(len,1); | |
| 13543 | 4125 | memcpy(temp_sample.data, datsamp->data, len); | |
| 13544 | 4125 | } | |
| 13545 | 14700 | else continue; | |
| 13546 | |||
| 13547 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4935 times.
|
4935 | if(keepdata) |
| 13548 | { | ||
| 13549 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4935 times.
|
4935 | if(customsfxdata[i].data!=NULL) |
| 13550 | { | ||
| 13551 | // delete [] customsfxdata[i].data; | ||
| 13552 | 4935 | free(customsfxdata[i].data); | |
| 13553 | 4935 | } | |
| 13554 | |||
| 13555 | // customsfxdata[i].data = new byte[(temp_sample.bits==8?1:2)*temp_sample.len]; | ||
| 13556 | 4935 | int32_t len2 = (temp_sample.bits==8?1:2)*(temp_sample.stereo==0?1:2)*temp_sample.len; | |
| 13557 | 4935 | customsfxdata[i].data = calloc(len2,1); | |
| 13558 | 4935 | customsfxdata[i].bits = temp_sample.bits; | |
| 13559 | 4935 | customsfxdata[i].stereo = temp_sample.stereo; | |
| 13560 | 4935 | customsfxdata[i].freq = temp_sample.freq; | |
| 13561 | 4935 | customsfxdata[i].priority = temp_sample.priority; | |
| 13562 | 4935 | customsfxdata[i].len = temp_sample.len; | |
| 13563 | 4935 | customsfxdata[i].loop_start = temp_sample.loop_start; | |
| 13564 | 4935 | customsfxdata[i].loop_end = temp_sample.loop_end; | |
| 13565 | 4935 | customsfxdata[i].param = temp_sample.param; | |
| 13566 | 4935 | int32_t cpylen = len2; | |
| 13567 | |||
| 13568 |
1/2✓ Branch 0 taken 4935 times.
✗ Branch 1 not taken.
|
4935 | if(s_version<3) |
| 13569 | { | ||
| 13570 | ✗ | cpylen = (temp_sample.bits==8?1:2)*temp_sample.len; | |
| 13571 | ✗ | al_trace("WARNING: Quest SFX %d is in stereo, and may be corrupt.\n",i); | |
| 13572 | } | ||
| 13573 | |||
| 13574 | 4935 | memcpy(customsfxdata[i].data,temp_sample.data,cpylen); | |
| 13575 | 4935 | } | |
| 13576 | |||
| 13577 | 4935 | free(temp_sample.data); | |
| 13578 | 4935 | } | |
| 13579 | |||
| 13580 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata) |
| 13581 | 77 | memcpy(customsfxflag, tempflag, WAV_COUNT>>3); | |
| 13582 | |||
| 13583 | 77 | sfxdat=0; | |
| 13584 | 77 | return 0; | |
| 13585 | 77 | } | |
| 13586 | |||
| 13587 | 77 | void setupsfx() | |
| 13588 | { | ||
| 13589 |
2/2✓ Branch 0 taken 19635 times.
✓ Branch 1 taken 77 times.
|
19712 | for(int32_t i=1; i<WAV_COUNT; i++) |
| 13590 | { | ||
| 13591 | 19635 | sprintf(sfx_string[i],"s%03d",i); | |
| 13592 | |||
| 13593 |
2/2✓ Branch 0 taken 15015 times.
✓ Branch 1 taken 4620 times.
|
19635 | if(i<Z35) |
| 13594 | { | ||
| 13595 | 4620 | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13596 | 4620 | } | |
| 13597 | |||
| 13598 | 19635 | memset(customsfxflag, 0, WAV_COUNT>>3); | |
| 13599 | |||
| 13600 | 19635 | int32_t j=i; | |
| 13601 | |||
| 13602 |
2/2✓ Branch 0 taken 4697 times.
✓ Branch 1 taken 14938 times.
|
19635 | if(i>Z35) |
| 13603 | { | ||
| 13604 | 14938 | i=Z35; | |
| 13605 | 14938 | } | |
| 13606 | |||
| 13607 | 19635 | SAMPLE *temp_sample = (SAMPLE *)sfxdata[i].dat; | |
| 13608 | |||
| 13609 |
2/2✓ Branch 0 taken 3570 times.
✓ Branch 1 taken 16065 times.
|
19635 | if(customsfxdata[j].data!=NULL) |
| 13610 | { | ||
| 13611 | // delete [] customsfxdata[j].data; | ||
| 13612 | 16065 | free(customsfxdata[j].data); | |
| 13613 | 16065 | } | |
| 13614 | |||
| 13615 | // customsfxdata[j].data = new byte[(temp_sample->bits==8?1:2)*temp_sample->len]; | ||
| 13616 | 19635 | customsfxdata[j].data = calloc((temp_sample->bits==8?1:2)*(temp_sample->stereo == 0 ? 1 : 2)*temp_sample->len,1); | |
| 13617 | 19635 | customsfxdata[j].bits = temp_sample->bits; | |
| 13618 | 19635 | customsfxdata[j].stereo = temp_sample->stereo; | |
| 13619 | 19635 | customsfxdata[j].freq = temp_sample->freq; | |
| 13620 | 19635 | customsfxdata[j].priority = temp_sample->priority; | |
| 13621 | 19635 | customsfxdata[j].len = temp_sample->len; | |
| 13622 | 19635 | customsfxdata[j].loop_start = temp_sample->loop_start; | |
| 13623 | 19635 | customsfxdata[j].loop_end = temp_sample->loop_end; | |
| 13624 | 19635 | customsfxdata[j].param = temp_sample->param; | |
| 13625 | 19635 | memcpy(customsfxdata[j].data, (temp_sample->data), (temp_sample->bits==8?1:2)*(temp_sample->stereo==0 ? 1 : 2)*temp_sample->len); | |
| 13626 | 19635 | i=j; | |
| 13627 | 19635 | } | |
| 13628 | 77 | } | |
| 13629 | |||
| 13630 | extern char *guy_string[eMAXGUYS]; | ||
| 13631 | extern const char *old_guy_string[OLDMAXGUYS]; | ||
| 13632 | |||
| 13633 | 77 | int32_t readguys(PACKFILE *f, zquestheader *Header, bool keepdata) | |
| 13634 | { | ||
| 13635 | dword dummy; | ||
| 13636 | word guy_cversion; | ||
| 13637 | 77 | word guyversion=0; | |
| 13638 | |||
| 13639 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(Header->zelda_version >= 0x193) |
| 13640 | { | ||
| 13641 | //section version info | ||
| 13642 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&guyversion,f,true)) |
| 13643 | { | ||
| 13644 | ✗ | return qe_invalid; | |
| 13645 | } | ||
| 13646 | |||
| 13647 | 77 | FFCore.quest_format[vGuys] = guyversion; | |
| 13648 | |||
| 13649 | //al_trace("Guys version %d\n", guyversion); | ||
| 13650 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&guy_cversion,f,true)) |
| 13651 | { | ||
| 13652 | ✗ | return qe_invalid; | |
| 13653 | } | ||
| 13654 | 77 | al_trace("Guy CVersion is: %d\n", guy_cversion); | |
| 13655 | //section size | ||
| 13656 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&dummy,f,true)) |
| 13657 | { | ||
| 13658 | ✗ | return qe_invalid; | |
| 13659 | } | ||
| 13660 | 77 | } | |
| 13661 | |||
| 13662 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(guyversion > 3) |
| 13663 | { | ||
| 13664 |
2/2✓ Branch 0 taken 39424 times.
✓ Branch 1 taken 77 times.
|
39501 | for(int32_t i=0; i<MAXGUYS; i++) |
| 13665 | { | ||
| 13666 | char tempname[64]; | ||
| 13667 | |||
| 13668 | // rev. 1511 : guyversion = 23. upped to 512 editable enemies. -Gleeok | ||
| 13669 | // if guyversion < 23 then there is only 256 enemies in the packfile, so default the rest. | ||
| 13670 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 39424 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
39424 | if(guyversion < 23 && i >= OLDBETAMAXGUYS && keepdata) |
| 13671 | { | ||
| 13672 | ✗ | memset(tempname, 0, sizeof(char)*64); | |
| 13673 | ✗ | sprintf(tempname, "e%03d", i); | |
| 13674 | ✗ | strcpy(guy_string[i], tempname); | |
| 13675 | |||
| 13676 | ✗ | continue; | |
| 13677 | } | ||
| 13678 | |||
| 13679 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!pfread(tempname, 64, f, keepdata)) |
| 13680 | { | ||
| 13681 | ✗ | return qe_invalid; | |
| 13682 | } | ||
| 13683 | |||
| 13684 | // Don't retain names of uneditable enemy entries! | ||
| 13685 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 39424 times.
|
39424 | if(keepdata) |
| 13686 | { | ||
| 13687 | // for version upgrade to 2.5 | ||
| 13688 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 39424 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
39424 | if(guyversion < 23 && i >= 177) |
| 13689 | { | ||
| 13690 | // some of the older builds have names such as 'zz123', | ||
| 13691 | // (this order gets messed up with some eXXX and some zzXXX) | ||
| 13692 | // so let's update to the newer naming convection. -Gleeok | ||
| 13693 | char tmpbuf[64]; | ||
| 13694 | ✗ | memset(tmpbuf, 0, sizeof(char)*64); | |
| 13695 | ✗ | sprintf(tmpbuf, "zz%03d", i); | |
| 13696 | |||
| 13697 | ✗ | if(memcmp(tempname, tmpbuf, size_t(5)) == 0) | |
| 13698 | { | ||
| 13699 | ✗ | memset(tempname, 0, sizeof(char)*64); | |
| 13700 | ✗ | sprintf(tempname, "e%03d", i); | |
| 13701 | } | ||
| 13702 | } | ||
| 13703 | |||
| 13704 |
6/6✓ Branch 0 taken 13629 times.
✓ Branch 1 taken 25795 times.
✓ Branch 2 taken 12936 times.
✓ Branch 3 taken 693 times.
✓ Branch 4 taken 10343 times.
✓ Branch 5 taken 2593 times.
|
39424 | if(i >= OLDMAXGUYS || strlen(tempname)<1 || tempname[strlen(tempname)-1]!=' ') |
| 13705 | { | ||
| 13706 | 36831 | strcpy(guy_string[i], tempname); | |
| 13707 | 36831 | } | |
| 13708 | else | ||
| 13709 | { | ||
| 13710 | 2593 | strcpy(guy_string[i],old_guy_string[i]); | |
| 13711 | } | ||
| 13712 | 39424 | } | |
| 13713 | 39424 | } | |
| 13714 | 77 | } | |
| 13715 | else | ||
| 13716 | { | ||
| 13717 | ✗ | if(keepdata) | |
| 13718 | { | ||
| 13719 | ✗ | for(int32_t i=0; i<eMAXGUYS; i++) | |
| 13720 | { | ||
| 13721 | ✗ | sprintf(guy_string[i],"zz%03d",i); | |
| 13722 | } | ||
| 13723 | |||
| 13724 | ✗ | for(int32_t i=0; i<OLDMAXGUYS; i++) | |
| 13725 | { | ||
| 13726 | ✗ | strcpy(guy_string[i],old_guy_string[i]); | |
| 13727 | } | ||
| 13728 | } | ||
| 13729 | } | ||
| 13730 | |||
| 13731 | |||
| 13732 | //finally... section data | ||
| 13733 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata) |
| 13734 | { | ||
| 13735 | 77 | init_guys(guyversion); //using default data for now... | |
| 13736 | |||
| 13737 | // Goriya guy fix | ||
| 13738 |
2/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if((Header->zelda_version < 0x211)||((Header->zelda_version == 0x211)&&(Header->build<7))) |
| 13739 | { | ||
| 13740 | ✗ | if(get_bit(quest_rules,qr_NEWENEMYTILES)) | |
| 13741 | { | ||
| 13742 | ✗ | guysbuf[gGORIYA].tile=130; | |
| 13743 | ✗ | guysbuf[gGORIYA].e_tile=130; | |
| 13744 | } | ||
| 13745 | } | ||
| 13746 | 77 | } | |
| 13747 | |||
| 13748 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(Header->zelda_version < 0x193) |
| 13749 | { | ||
| 13750 | ✗ | if(get_bit(deprecated_rules,46)) | |
| 13751 | { | ||
| 13752 | ✗ | guysbuf[eDODONGO].cset=14; | |
| 13753 | ✗ | guysbuf[eDODONGO].bosspal=spDIG; | |
| 13754 | } | ||
| 13755 | } | ||
| 13756 | // Not sure when this first changed, but it's necessary for 2.10, at least | ||
| 13757 | // @TODO: @BUG:1.92 - 1.84? Figure this out exactly for the final 2.50 release. | ||
| 13758 | //2.10 Fixes | ||
| 13759 |
2/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if((Header->zelda_version < 0x211)||((Header->zelda_version == 0x211)&&(Header->build<18))) |
| 13760 | { | ||
| 13761 | ✗ | guysbuf[eWWIZ].editorflags |= ENEMY_FLAG5; | |
| 13762 | ✗ | guysbuf[eMOLDORM].editorflags |= ENEMY_FLAG6; | |
| 13763 | ✗ | guysbuf[eMANHAN].editorflags |= ENEMY_FLAG6; | |
| 13764 | ✗ | guysbuf[eCENT1].misc3 = 1; | |
| 13765 | ✗ | guysbuf[eCENT2].misc3 = 1; | |
| 13766 | } | ||
| 13767 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if((Header->zelda_version <= 0x255) || (Header->zelda_version == 0x255 && Header->build < 47) ) |
| 13768 | { | ||
| 13769 | 77 | guysbuf[eWPOLSV].defense[edefWhistle] = ed1HKO; | |
| 13770 | 77 | } | |
| 13771 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(Header->zelda_version <= 0x210) |
| 13772 | { | ||
| 13773 | ✗ | guysbuf[eGLEEOK1F].misc6 = 16; | |
| 13774 | ✗ | guysbuf[eGLEEOK2F].misc6 = 16; | |
| 13775 | ✗ | guysbuf[eGLEEOK3F].misc6 = 16; | |
| 13776 | ✗ | guysbuf[eGLEEOK4F].misc6 = 16; | |
| 13777 | |||
| 13778 | ✗ | guysbuf[eWIZ1].misc4 = 1; //only set the enemy that needs backward compat, not all of them. | |
| 13779 | ✗ | guysbuf[eBATROBE].misc4 = 1; | |
| 13780 | //guysbuf[eSUMMONER].misc4 = 1; | ||
| 13781 | ✗ | guysbuf[eWWIZ].misc4 = 1; | |
| 13782 | ✗ | guysbuf[eDODONGO].deadsfx = 15; //In 2.10 and earlier, Dodongos used this as their death sound. | |
| 13783 | ✗ | guysbuf[eDODONGOBS].deadsfx = 15; //In 2.10 and earlier, Dodongos used this as their death sound. | |
| 13784 | } | ||
| 13785 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(Header->zelda_version == 0x190) |
| 13786 | { | ||
| 13787 | ✗ | al_trace("Setting Tribble Properties for Version: %x", Header->zelda_version); | |
| 13788 | ✗ | guysbuf[eKEESETRIB].misc3 = eVIRE; //1.90 and earlier, keese and gel tribbles grew up into | |
| 13789 | ✗ | guysbuf[eGELTRIB].misc3 = eZOL; //normal vires, and zols -Z (16th January, 2019 ) | |
| 13790 | } | ||
| 13791 | |||
| 13792 | // The versions here may not be correct | ||
| 13793 | // zelda_version>=0x211 handled at guyversion<24 | ||
| 13794 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(Header->zelda_version <= 0x190) |
| 13795 | { | ||
| 13796 | ✗ | guysbuf[eCENT1].misc3 = 0; | |
| 13797 | ✗ | guysbuf[eCENT2].misc3 = 0; | |
| 13798 | ✗ | guysbuf[eMOLDORM].misc2 = 0; | |
| 13799 | //guysbuf[eKEESETRIB].misc3 = eVIRE; //1.90 and earlier, keese and gel tribbles grew up into | ||
| 13800 | //guysbuf[eGELTRIB].misc3 = eZOL; //normal vires, and zols -Z (16th January, 2019 ) | ||
| 13801 | } | ||
| 13802 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | else if(Header->zelda_version <= 0x210) |
| 13803 | { | ||
| 13804 | ✗ | guysbuf[eCENT1].misc3 = 1; | |
| 13805 | ✗ | guysbuf[eCENT2].misc3 = 1; | |
| 13806 | ✗ | guysbuf[eMOLDORM].misc2 = 0; | |
| 13807 | } | ||
| 13808 | |||
| 13809 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if ( Header->zelda_version < 0x211 ) //Default rest rates for phantom ghinis, peahats and keese in < 2.50 quests |
| 13810 | { | ||
| 13811 | ✗ | guysbuf[eKEESE1].misc16 = 120; | |
| 13812 | ✗ | guysbuf[eKEESE2].misc16 = 120; | |
| 13813 | ✗ | guysbuf[eKEESE3].misc16 = 120; | |
| 13814 | ✗ | guysbuf[eKEESETRIB].misc16 = 120; | |
| 13815 | ✗ | guysbuf[eKEESE1].misc17 = 16; | |
| 13816 | ✗ | guysbuf[eKEESE2].misc17 = 16; | |
| 13817 | ✗ | guysbuf[eKEESE3].misc17 = 16; | |
| 13818 | ✗ | guysbuf[eKEESETRIB].misc17 = 16; | |
| 13819 | |||
| 13820 | ✗ | guysbuf[ePEAHAT].misc16 = 80; | |
| 13821 | ✗ | guysbuf[ePEAHAT].misc17 = 16; | |
| 13822 | |||
| 13823 | ✗ | guysbuf[eGHINI2].misc16 = 120; | |
| 13824 | ✗ | guysbuf[eGHINI2].misc17 = 10; | |
| 13825 | |||
| 13826 | } | ||
| 13827 | |||
| 13828 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(guyversion<=2) |
| 13829 | { | ||
| 13830 | ✗ | return readherosprites2(f, guyversion==2?0:-1, 0, keepdata); | |
| 13831 | } | ||
| 13832 | |||
| 13833 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(guyversion > 3) |
| 13834 | { | ||
| 13835 | guydata tempguy; | ||
| 13836 | |||
| 13837 |
2/2✓ Branch 0 taken 39424 times.
✓ Branch 1 taken 77 times.
|
39501 | for(int32_t i=0; i<MAXGUYS; i++) |
| 13838 | { | ||
| 13839 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 39424 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
39424 | if(guyversion < 23 && keepdata) // May 2012 : 512 max enemies |
| 13840 | { | ||
| 13841 | ✗ | if(i >= OLDBETAMAXGUYS) | |
| 13842 | { | ||
| 13843 | ✗ | memset(&guysbuf[i], 0, sizeof(guydata)); | |
| 13844 | ✗ | continue; | |
| 13845 | } | ||
| 13846 | } | ||
| 13847 | |||
| 13848 | 39424 | memset(&tempguy, 0, sizeof(guydata)); | |
| 13849 | |||
| 13850 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetl(&(tempguy.flags),f,keepdata)) |
| 13851 | { | ||
| 13852 | ✗ | return qe_invalid; | |
| 13853 | } | ||
| 13854 | |||
| 13855 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetl(&(tempguy.flags2),f,keepdata)) |
| 13856 | { | ||
| 13857 | ✗ | return qe_invalid; | |
| 13858 | } | ||
| 13859 | |||
| 13860 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if ( guyversion >= 36 ) //expanded tiles |
| 13861 | { | ||
| 13862 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.tile),f,keepdata)) |
| 13863 | { | ||
| 13864 | ✗ | return qe_invalid; | |
| 13865 | } | ||
| 13866 | 4096 | } | |
| 13867 | else | ||
| 13868 | { | ||
| 13869 |
1/2✓ Branch 0 taken 35328 times.
✗ Branch 1 not taken.
|
35328 | if(!p_igetw(&(tempguy.tile),f,keepdata)) |
| 13870 | { | ||
| 13871 | ✗ | return qe_invalid; | |
| 13872 | } | ||
| 13873 | } | ||
| 13874 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&(tempguy.width),f,keepdata)) |
| 13875 | { | ||
| 13876 | ✗ | return qe_invalid; | |
| 13877 | } | ||
| 13878 | |||
| 13879 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&(tempguy.height),f,keepdata)) |
| 13880 | { | ||
| 13881 | ✗ | return qe_invalid; | |
| 13882 | } | ||
| 13883 | |||
| 13884 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if ( guyversion >= 36 ) //expanded tiles |
| 13885 | { | ||
| 13886 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.s_tile),f,keepdata)) |
| 13887 | { | ||
| 13888 | ✗ | return qe_invalid; | |
| 13889 | } | ||
| 13890 | 4096 | } | |
| 13891 | else | ||
| 13892 | { | ||
| 13893 |
1/2✓ Branch 0 taken 35328 times.
✗ Branch 1 not taken.
|
35328 | if(!p_igetw(&(tempguy.s_tile),f,keepdata)) |
| 13894 | { | ||
| 13895 | ✗ | return qe_invalid; | |
| 13896 | } | ||
| 13897 | } | ||
| 13898 | |||
| 13899 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&(tempguy.s_width),f,keepdata)) |
| 13900 | { | ||
| 13901 | ✗ | return qe_invalid; | |
| 13902 | } | ||
| 13903 | |||
| 13904 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&(tempguy.s_height),f,keepdata)) |
| 13905 | { | ||
| 13906 | ✗ | return qe_invalid; | |
| 13907 | } | ||
| 13908 | |||
| 13909 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if ( guyversion >= 36 ) //expanded tiles |
| 13910 | { | ||
| 13911 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.e_tile),f,keepdata)) |
| 13912 | { | ||
| 13913 | ✗ | return qe_invalid; | |
| 13914 | } | ||
| 13915 | 4096 | } | |
| 13916 | else | ||
| 13917 | { | ||
| 13918 |
1/2✓ Branch 0 taken 35328 times.
✗ Branch 1 not taken.
|
35328 | if(!p_igetw(&(tempguy.e_tile),f,keepdata)) |
| 13919 | { | ||
| 13920 | ✗ | return qe_invalid; | |
| 13921 | } | ||
| 13922 | } | ||
| 13923 | |||
| 13924 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&(tempguy.e_width),f,keepdata)) |
| 13925 | { | ||
| 13926 | ✗ | return qe_invalid; | |
| 13927 | } | ||
| 13928 | |||
| 13929 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&(tempguy.e_height),f,keepdata)) |
| 13930 | { | ||
| 13931 | ✗ | return qe_invalid; | |
| 13932 | } | ||
| 13933 | |||
| 13934 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&(tempguy.hp),f,keepdata)) |
| 13935 | { | ||
| 13936 | ✗ | return qe_invalid; | |
| 13937 | } | ||
| 13938 | |||
| 13939 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&(tempguy.family),f,keepdata)) |
| 13940 | { | ||
| 13941 | ✗ | return qe_invalid; | |
| 13942 | } | ||
| 13943 | |||
| 13944 |
1/12✗ Branch 0 not taken.
✓ Branch 1 taken 39424 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
39424 | if(guyversion < 9 && (i==eDKNUT1 || i==eDKNUT2 || i==eDKNUT3 || i==eDKNUT4 || i==eDKNUT5)) // Whoops, forgot about Darknuts... |
| 13945 | { | ||
| 13946 | ✗ | if(get_bit(quest_rules,qr_NEWENEMYTILES)) | |
| 13947 | { | ||
| 13948 | ✗ | tempguy.s_tile=tempguy.e_tile+120; | |
| 13949 | ✗ | tempguy.s_width=tempguy.e_width; | |
| 13950 | ✗ | tempguy.s_height=tempguy.e_height; | |
| 13951 | } | ||
| 13952 | ✗ | else tempguy.s_tile=860; | |
| 13953 | } | ||
| 13954 | |||
| 13955 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&(tempguy.cset),f,keepdata)) |
| 13956 | { | ||
| 13957 | ✗ | return qe_invalid; | |
| 13958 | } | ||
| 13959 | |||
| 13960 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&(tempguy.anim),f,keepdata)) |
| 13961 | { | ||
| 13962 | ✗ | return qe_invalid; | |
| 13963 | } | ||
| 13964 | |||
| 13965 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&(tempguy.e_anim),f,keepdata)) |
| 13966 | { | ||
| 13967 | ✗ | return qe_invalid; | |
| 13968 | } | ||
| 13969 | |||
| 13970 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&(tempguy.frate),f,keepdata)) |
| 13971 | { | ||
| 13972 | ✗ | return qe_invalid; | |
| 13973 | } | ||
| 13974 | |||
| 13975 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&(tempguy.e_frate),f,keepdata)) |
| 13976 | { | ||
| 13977 | ✗ | return qe_invalid; | |
| 13978 | } | ||
| 13979 | |||
| 13980 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(guyversion < 13) // April 2009 |
| 13981 | { | ||
| 13982 | ✗ | if(get_bit(deprecated_rules, qr_SLOWENEMYANIM_DEP)) | |
| 13983 | { | ||
| 13984 | ✗ | tempguy.frate *= 2; | |
| 13985 | ✗ | tempguy.e_frate *= 2; | |
| 13986 | } | ||
| 13987 | } | ||
| 13988 | |||
| 13989 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(guyversion < 14) // May 1 2009 |
| 13990 | { | ||
| 13991 | ✗ | if(tempguy.anim==a2FRMSLOW) | |
| 13992 | { | ||
| 13993 | ✗ | tempguy.anim=a2FRM; | |
| 13994 | ✗ | tempguy.frate *= 2; | |
| 13995 | } | ||
| 13996 | |||
| 13997 | ✗ | if(tempguy.e_anim==a2FRMSLOW) | |
| 13998 | { | ||
| 13999 | ✗ | tempguy.e_anim=a2FRM; | |
| 14000 | ✗ | tempguy.e_frate *= 2; | |
| 14001 | } | ||
| 14002 | |||
| 14003 | ✗ | if(tempguy.anim==aFLIPSLOW) | |
| 14004 | { | ||
| 14005 | ✗ | tempguy.anim=aFLIP; | |
| 14006 | ✗ | tempguy.frate *= 2; | |
| 14007 | } | ||
| 14008 | |||
| 14009 | ✗ | if(tempguy.e_anim==aFLIPSLOW) | |
| 14010 | { | ||
| 14011 | ✗ | tempguy.e_anim=aFLIP; | |
| 14012 | ✗ | tempguy.e_frate *= 2; | |
| 14013 | } | ||
| 14014 | |||
| 14015 | ✗ | if(tempguy.anim == aNEWDWALK) tempguy.anim = a4FRM4DIR; | |
| 14016 | |||
| 14017 | ✗ | if(tempguy.e_anim == aNEWDWALK) tempguy.e_anim = a4FRM4DIR; | |
| 14018 | |||
| 14019 | ✗ | if(tempguy.anim == aNEWPOLV || tempguy.anim == a4FRM3TRAP) | |
| 14020 | { | ||
| 14021 | ✗ | tempguy.anim=a4FRM4DIR; | |
| 14022 | ✗ | tempguy.s_tile=(get_bit(quest_rules,qr_NEWENEMYTILES) ? tempguy.e_tile : tempguy.tile)+20; | |
| 14023 | } | ||
| 14024 | |||
| 14025 | ✗ | if(tempguy.e_anim == aNEWPOLV || tempguy.e_anim == a4FRM3TRAP) | |
| 14026 | { | ||
| 14027 | ✗ | tempguy.e_anim=a4FRM4DIR; | |
| 14028 | ✗ | tempguy.s_tile=(get_bit(quest_rules,qr_NEWENEMYTILES) ? tempguy.e_tile : tempguy.tile)+20; | |
| 14029 | } | ||
| 14030 | } | ||
| 14031 | |||
| 14032 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&(tempguy.dp),f,keepdata)) |
| 14033 | { | ||
| 14034 | ✗ | return qe_invalid; | |
| 14035 | } | ||
| 14036 | |||
| 14037 | //correction for guy fire | ||
| 14038 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(guyversion < 6) |
| 14039 | { | ||
| 14040 | ✗ | if(i == gFIRE) | |
| 14041 | ✗ | tempguy.dp = 2; | |
| 14042 | } | ||
| 14043 | |||
| 14044 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&(tempguy.wdp),f,keepdata)) |
| 14045 | { | ||
| 14046 | ✗ | return qe_invalid; | |
| 14047 | } | ||
| 14048 | |||
| 14049 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&(tempguy.weapon),f,keepdata)) |
| 14050 | { | ||
| 14051 | ✗ | return qe_invalid; | |
| 14052 | } | ||
| 14053 | |||
| 14054 | //correction for bosses using triple, "rising" fireballs | ||
| 14055 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(guyversion < 5) |
| 14056 | { | ||
| 14057 | ✗ | if(i == eLAQUAM || i == eRAQUAM || i == eGOHMA1 || i == eGOHMA2 || | |
| 14058 | ✗ | i == eGOHMA3 || i == eGOHMA4) | |
| 14059 | { | ||
| 14060 | ✗ | if(tempguy.weapon == ewFireball) | |
| 14061 | ✗ | tempguy.weapon = ewFireball2; | |
| 14062 | } | ||
| 14063 | } | ||
| 14064 | |||
| 14065 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&(tempguy.rate),f,keepdata)) |
| 14066 | { | ||
| 14067 | ✗ | return qe_invalid; | |
| 14068 | } | ||
| 14069 | |||
| 14070 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&(tempguy.hrate),f,keepdata)) |
| 14071 | { | ||
| 14072 | ✗ | return qe_invalid; | |
| 14073 | } | ||
| 14074 | |||
| 14075 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&(tempguy.step),f,keepdata)) |
| 14076 | { | ||
| 14077 | ✗ | return qe_invalid; | |
| 14078 | } | ||
| 14079 | |||
| 14080 | // HIGHLY UNORTHODOX UPDATING THING, part 2 | ||
| 14081 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 39424 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
39424 | if(fixpolsvoice && tempguy.family==eePOLSV) |
| 14082 | { | ||
| 14083 | ✗ | tempguy.step /= 2; | |
| 14084 | } | ||
| 14085 | |||
| 14086 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&(tempguy.homing),f,keepdata)) |
| 14087 | { | ||
| 14088 | ✗ | return qe_invalid; | |
| 14089 | } | ||
| 14090 | |||
| 14091 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&(tempguy.grumble),f,keepdata)) |
| 14092 | { | ||
| 14093 | ✗ | return qe_invalid; | |
| 14094 | } | ||
| 14095 | |||
| 14096 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&(tempguy.item_set),f,keepdata)) |
| 14097 | { | ||
| 14098 | ✗ | return qe_invalid; | |
| 14099 | } | ||
| 14100 | |||
| 14101 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(guyversion>=22) // Version 22: Expand misc attributes to 32 bits |
| 14102 | { | ||
| 14103 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetl(&(tempguy.misc1),f,keepdata)) |
| 14104 | { | ||
| 14105 | ✗ | return qe_invalid; | |
| 14106 | } | ||
| 14107 | |||
| 14108 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetl(&(tempguy.misc2),f,keepdata)) |
| 14109 | { | ||
| 14110 | ✗ | return qe_invalid; | |
| 14111 | } | ||
| 14112 | |||
| 14113 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetl(&(tempguy.misc3),f,keepdata)) |
| 14114 | { | ||
| 14115 | ✗ | return qe_invalid; | |
| 14116 | } | ||
| 14117 | |||
| 14118 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetl(&(tempguy.misc4),f,keepdata)) |
| 14119 | { | ||
| 14120 | ✗ | return qe_invalid; | |
| 14121 | } | ||
| 14122 | |||
| 14123 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetl(&(tempguy.misc5),f,keepdata)) |
| 14124 | { | ||
| 14125 | ✗ | return qe_invalid; | |
| 14126 | } | ||
| 14127 | |||
| 14128 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetl(&(tempguy.misc6),f,keepdata)) |
| 14129 | { | ||
| 14130 | ✗ | return qe_invalid; | |
| 14131 | } | ||
| 14132 | |||
| 14133 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetl(&(tempguy.misc7),f,keepdata)) |
| 14134 | { | ||
| 14135 | ✗ | return qe_invalid; | |
| 14136 | } | ||
| 14137 | |||
| 14138 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetl(&(tempguy.misc8),f,keepdata)) |
| 14139 | { | ||
| 14140 | ✗ | return qe_invalid; | |
| 14141 | } | ||
| 14142 | |||
| 14143 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetl(&(tempguy.misc9),f,keepdata)) |
| 14144 | { | ||
| 14145 | ✗ | return qe_invalid; | |
| 14146 | } | ||
| 14147 | |||
| 14148 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetl(&(tempguy.misc10),f,keepdata)) |
| 14149 | { | ||
| 14150 | ✗ | return qe_invalid; | |
| 14151 | } | ||
| 14152 | 39424 | } | |
| 14153 | else | ||
| 14154 | { | ||
| 14155 | int16_t tempMisc; | ||
| 14156 | |||
| 14157 | ✗ | if(!p_igetw(&tempMisc,f,keepdata)) | |
| 14158 | { | ||
| 14159 | ✗ | return qe_invalid; | |
| 14160 | } | ||
| 14161 | |||
| 14162 | ✗ | tempguy.misc1=tempMisc; | |
| 14163 | |||
| 14164 | ✗ | if(!p_igetw(&tempMisc,f,keepdata)) | |
| 14165 | { | ||
| 14166 | ✗ | return qe_invalid; | |
| 14167 | } | ||
| 14168 | |||
| 14169 | ✗ | tempguy.misc2=tempMisc; | |
| 14170 | |||
| 14171 | ✗ | if(!p_igetw(&tempMisc,f,keepdata)) | |
| 14172 | { | ||
| 14173 | ✗ | return qe_invalid; | |
| 14174 | } | ||
| 14175 | |||
| 14176 | ✗ | tempguy.misc3=tempMisc; | |
| 14177 | |||
| 14178 | ✗ | if(!p_igetw(&tempMisc,f,keepdata)) | |
| 14179 | { | ||
| 14180 | ✗ | return qe_invalid; | |
| 14181 | } | ||
| 14182 | |||
| 14183 | ✗ | tempguy.misc4=tempMisc; | |
| 14184 | |||
| 14185 | ✗ | if(!p_igetw(&tempMisc,f,keepdata)) | |
| 14186 | { | ||
| 14187 | ✗ | return qe_invalid; | |
| 14188 | } | ||
| 14189 | |||
| 14190 | ✗ | tempguy.misc5=tempMisc; | |
| 14191 | |||
| 14192 | ✗ | if(guyversion < 13) // April 2009 - a tiny Wizzrobe update | |
| 14193 | { | ||
| 14194 | ✗ | if(tempguy.family == eeWIZZ && !(tempguy.misc1)) | |
| 14195 | ✗ | tempguy.misc5 = 74; | |
| 14196 | } | ||
| 14197 | |||
| 14198 | ✗ | if(!p_igetw(&tempMisc,f,keepdata)) | |
| 14199 | { | ||
| 14200 | ✗ | return qe_invalid; | |
| 14201 | } | ||
| 14202 | |||
| 14203 | ✗ | tempguy.misc6=tempMisc; | |
| 14204 | |||
| 14205 | ✗ | if(!p_igetw(&tempMisc,f,keepdata)) | |
| 14206 | { | ||
| 14207 | ✗ | return qe_invalid; | |
| 14208 | } | ||
| 14209 | |||
| 14210 | ✗ | tempguy.misc7=tempMisc; | |
| 14211 | |||
| 14212 | ✗ | if(!p_igetw(&tempMisc,f,keepdata)) | |
| 14213 | { | ||
| 14214 | ✗ | return qe_invalid; | |
| 14215 | } | ||
| 14216 | |||
| 14217 | ✗ | tempguy.misc8=tempMisc; | |
| 14218 | |||
| 14219 | ✗ | if(!p_igetw(&tempMisc,f,keepdata)) | |
| 14220 | { | ||
| 14221 | ✗ | return qe_invalid; | |
| 14222 | } | ||
| 14223 | |||
| 14224 | ✗ | tempguy.misc9=tempMisc; | |
| 14225 | |||
| 14226 | ✗ | if(!p_igetw(&tempMisc,f,keepdata)) | |
| 14227 | { | ||
| 14228 | ✗ | return qe_invalid; | |
| 14229 | } | ||
| 14230 | |||
| 14231 | ✗ | tempguy.misc10=tempMisc; | |
| 14232 | } | ||
| 14233 | |||
| 14234 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&(tempguy.bgsfx),f,keepdata)) |
| 14235 | { | ||
| 14236 | ✗ | return qe_invalid; | |
| 14237 | } | ||
| 14238 | |||
| 14239 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&(tempguy.bosspal),f,keepdata)) |
| 14240 | { | ||
| 14241 | ✗ | return qe_invalid; | |
| 14242 | } | ||
| 14243 | |||
| 14244 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetw(&(tempguy.extend),f,keepdata)) |
| 14245 | { | ||
| 14246 | ✗ | return qe_invalid; | |
| 14247 | } | ||
| 14248 | |||
| 14249 | //! Enemy Defences | ||
| 14250 | |||
| 14251 | //If a 2.50 quest, use only the 2.5 defences. | ||
| 14252 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 39424 times.
|
39424 | if(guyversion >= 16 ) // November 2009 - Super Enemy Editor |
| 14253 | { | ||
| 14254 |
2/2✓ Branch 0 taken 749056 times.
✓ Branch 1 taken 39424 times.
|
788480 | for(int32_t j=0; j<edefLAST; j++) |
| 14255 | { | ||
| 14256 |
1/2✓ Branch 0 taken 749056 times.
✗ Branch 1 not taken.
|
749056 | if(!p_getc(&(tempguy.defense[j]),f,keepdata)) |
| 14257 | { | ||
| 14258 | ✗ | return qe_invalid; | |
| 14259 | } | ||
| 14260 | 749056 | } | |
| 14261 | //then copy the generic script defence to all the new script defences | ||
| 14262 | |||
| 14263 | 39424 | } | |
| 14264 | |||
| 14265 | |||
| 14266 | |||
| 14267 | |||
| 14268 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 39424 times.
|
39424 | if(guyversion >= 18) |
| 14269 | { | ||
| 14270 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&(tempguy.hitsfx),f,keepdata)) |
| 14271 | { | ||
| 14272 | ✗ | return qe_invalid; | |
| 14273 | } | ||
| 14274 | |||
| 14275 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_getc(&(tempguy.deadsfx),f,keepdata)) |
| 14276 | { | ||
| 14277 | ✗ | return qe_invalid; | |
| 14278 | } | ||
| 14279 | 39424 | } | |
| 14280 | |||
| 14281 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(guyversion >= 22) |
| 14282 | { | ||
| 14283 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetl(&(tempguy.misc11),f,keepdata)) |
| 14284 | { | ||
| 14285 | ✗ | return qe_invalid; | |
| 14286 | } | ||
| 14287 | |||
| 14288 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!p_igetl(&(tempguy.misc12),f,keepdata)) |
| 14289 | { | ||
| 14290 | ✗ | return qe_invalid; | |
| 14291 | } | ||
| 14292 | 39424 | } | |
| 14293 | ✗ | else if(guyversion >= 19) | |
| 14294 | { | ||
| 14295 | int16_t tempMisc; | ||
| 14296 | |||
| 14297 | ✗ | if(!p_igetw(&tempMisc,f,keepdata)) | |
| 14298 | { | ||
| 14299 | ✗ | return qe_invalid; | |
| 14300 | } | ||
| 14301 | |||
| 14302 | ✗ | tempguy.misc11=tempMisc; | |
| 14303 | |||
| 14304 | ✗ | if(!p_igetw(&tempMisc,f,keepdata)) | |
| 14305 | { | ||
| 14306 | ✗ | return qe_invalid; | |
| 14307 | } | ||
| 14308 | |||
| 14309 | ✗ | tempguy.misc12=tempMisc; | |
| 14310 | } | ||
| 14311 | |||
| 14312 | //If a 2.54 or later quest, use all of the defences. | ||
| 14313 |
2/2✓ Branch 0 taken 35328 times.
✓ Branch 1 taken 4096 times.
|
39424 | if(guyversion > 24) // Add new guyversion conditional statement |
| 14314 | { | ||
| 14315 |
2/2✓ Branch 0 taken 90112 times.
✓ Branch 1 taken 4096 times.
|
94208 | for(int32_t j=edefLAST; j<edefLAST255; j++) |
| 14316 | { | ||
| 14317 |
1/2✓ Branch 0 taken 90112 times.
✗ Branch 1 not taken.
|
90112 | if(!p_getc(&(tempguy.defense[j]),f,keepdata)) |
| 14318 | { | ||
| 14319 | ✗ | return qe_invalid; | |
| 14320 | } | ||
| 14321 | 90112 | } | |
| 14322 | 4096 | } | |
| 14323 | |||
| 14324 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if(guyversion <= 24) // Port over generic script settings from old quests in the new editor. |
| 14325 | { | ||
| 14326 |
2/2✓ Branch 0 taken 353280 times.
✓ Branch 1 taken 35328 times.
|
388608 | for(int32_t j=edefSCRIPT01; j<=edefSCRIPT10; j++) |
| 14327 | { | ||
| 14328 | 353280 | tempguy.defense[j] = tempguy.defense[edefSCRIPT] ; | |
| 14329 | 353280 | } | |
| 14330 | 35328 | } | |
| 14331 | |||
| 14332 | //tilewidth, tileheight, hitwidth, hitheight, hitzheight, hitxofs, hityofs, hitzofs | ||
| 14333 |
2/2✓ Branch 0 taken 35328 times.
✓ Branch 1 taken 4096 times.
|
39424 | if(guyversion > 25) |
| 14334 | { | ||
| 14335 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.txsz),f,keepdata)) |
| 14336 | { | ||
| 14337 | ✗ | return qe_invalid; | |
| 14338 | } | ||
| 14339 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.tysz),f,keepdata)) |
| 14340 | { | ||
| 14341 | ✗ | return qe_invalid; | |
| 14342 | } | ||
| 14343 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.hxsz),f,keepdata)) |
| 14344 | { | ||
| 14345 | ✗ | return qe_invalid; | |
| 14346 | } | ||
| 14347 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.hysz),f,keepdata)) |
| 14348 | { | ||
| 14349 | ✗ | return qe_invalid; | |
| 14350 | } | ||
| 14351 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.hzsz),f,keepdata)) |
| 14352 | { | ||
| 14353 | ✗ | return qe_invalid; | |
| 14354 | } | ||
| 14355 | /* Is it safe to read a fixed with getl, or do I need to typecast it? -Z | ||
| 14356 | |||
| 14357 | */ | ||
| 14358 | 4096 | } | |
| 14359 | //More Enemy Editor vars for 2.60 | ||
| 14360 |
2/2✓ Branch 0 taken 35328 times.
✓ Branch 1 taken 4096 times.
|
39424 | if(guyversion > 26) |
| 14361 | { | ||
| 14362 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.hxofs),f,keepdata)) |
| 14363 | { | ||
| 14364 | ✗ | return qe_invalid; | |
| 14365 | } | ||
| 14366 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.hyofs),f,keepdata)) |
| 14367 | { | ||
| 14368 | ✗ | return qe_invalid; | |
| 14369 | } | ||
| 14370 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.xofs),f,keepdata)) |
| 14371 | { | ||
| 14372 | ✗ | return qe_invalid; | |
| 14373 | } | ||
| 14374 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.yofs),f,keepdata)) |
| 14375 | { | ||
| 14376 | ✗ | return qe_invalid; | |
| 14377 | } | ||
| 14378 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.zofs),f,keepdata)) |
| 14379 | { | ||
| 14380 | ✗ | return qe_invalid; | |
| 14381 | } | ||
| 14382 | 4096 | } | |
| 14383 | |||
| 14384 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if(guyversion <= 27) // Port over generic script settings from old quests in the new editor. |
| 14385 | { | ||
| 14386 | 35328 | tempguy.wpnsprite = 0; | |
| 14387 | 35328 | } | |
| 14388 | |||
| 14389 |
2/2✓ Branch 0 taken 35328 times.
✓ Branch 1 taken 4096 times.
|
39424 | if(guyversion > 27) |
| 14390 | { | ||
| 14391 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.wpnsprite),f,keepdata)) |
| 14392 | { | ||
| 14393 | ✗ | return qe_invalid; | |
| 14394 | } | ||
| 14395 | 4096 | } | |
| 14396 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if(guyversion <= 28) // Port over generic script settings from old quests in the new editor. |
| 14397 | { | ||
| 14398 | 35328 | tempguy.SIZEflags = 0; | |
| 14399 | 35328 | } | |
| 14400 |
2/2✓ Branch 0 taken 35328 times.
✓ Branch 1 taken 4096 times.
|
39424 | if(guyversion > 28) |
| 14401 | { | ||
| 14402 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.SIZEflags),f,keepdata)) |
| 14403 | { | ||
| 14404 | ✗ | return qe_invalid; | |
| 14405 | } | ||
| 14406 | |||
| 14407 | 4096 | } | |
| 14408 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if(guyversion < 30) // Port over generic script settings from old quests in the new editor. |
| 14409 | { | ||
| 14410 | 35328 | tempguy.frozentile = 0; | |
| 14411 | 35328 | tempguy.frozencset = 0; | |
| 14412 | 35328 | tempguy.frozenclock = 0; | |
| 14413 |
2/2✓ Branch 0 taken 353280 times.
✓ Branch 1 taken 35328 times.
|
388608 | for ( int32_t q = 0; q < 10; q++ ) tempguy.frozenmisc[q] = 0; |
| 14414 | 35328 | } | |
| 14415 |
2/2✓ Branch 0 taken 35328 times.
✓ Branch 1 taken 4096 times.
|
39424 | if(guyversion >= 30) |
| 14416 | { | ||
| 14417 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.frozentile),f,keepdata)) |
| 14418 | { | ||
| 14419 | ✗ | return qe_invalid; | |
| 14420 | } | ||
| 14421 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.frozencset),f,keepdata)) |
| 14422 | { | ||
| 14423 | ✗ | return qe_invalid; | |
| 14424 | } | ||
| 14425 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.frozenclock),f,keepdata)) |
| 14426 | { | ||
| 14427 | ✗ | return qe_invalid; | |
| 14428 | } | ||
| 14429 |
2/2✓ Branch 0 taken 40960 times.
✓ Branch 1 taken 4096 times.
|
45056 | for ( int32_t q = 0; q < 10; q++ ) { |
| 14430 |
1/2✓ Branch 0 taken 40960 times.
✗ Branch 1 not taken.
|
40960 | if(!p_igetw(&(tempguy.frozenmisc[q]),f,keepdata)) |
| 14431 | { | ||
| 14432 | ✗ | return qe_invalid; | |
| 14433 | } | ||
| 14434 | 40960 | } | |
| 14435 | |||
| 14436 | 4096 | } | |
| 14437 | |||
| 14438 |
2/2✓ Branch 0 taken 35328 times.
✓ Branch 1 taken 4096 times.
|
39424 | if(guyversion >= 34) |
| 14439 | { | ||
| 14440 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetw(&(tempguy.firesfx),f,keepdata)) |
| 14441 | { | ||
| 14442 | ✗ | return qe_invalid; | |
| 14443 | } | ||
| 14444 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc16),f,keepdata)) |
| 14445 | { | ||
| 14446 | ✗ | return qe_invalid; | |
| 14447 | } | ||
| 14448 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc17),f,keepdata)) |
| 14449 | { | ||
| 14450 | ✗ | return qe_invalid; | |
| 14451 | } | ||
| 14452 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc18),f,keepdata)) |
| 14453 | { | ||
| 14454 | ✗ | return qe_invalid; | |
| 14455 | } | ||
| 14456 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc19),f,keepdata)) |
| 14457 | { | ||
| 14458 | ✗ | return qe_invalid; | |
| 14459 | } | ||
| 14460 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc20),f,keepdata)) |
| 14461 | { | ||
| 14462 | ✗ | return qe_invalid; | |
| 14463 | } | ||
| 14464 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc21),f,keepdata)) |
| 14465 | { | ||
| 14466 | ✗ | return qe_invalid; | |
| 14467 | } | ||
| 14468 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc22),f,keepdata)) |
| 14469 | { | ||
| 14470 | ✗ | return qe_invalid; | |
| 14471 | } | ||
| 14472 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc23),f,keepdata)) |
| 14473 | { | ||
| 14474 | ✗ | return qe_invalid; | |
| 14475 | } | ||
| 14476 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc24),f,keepdata)) |
| 14477 | { | ||
| 14478 | ✗ | return qe_invalid; | |
| 14479 | } | ||
| 14480 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc25),f,keepdata)) |
| 14481 | { | ||
| 14482 | ✗ | return qe_invalid; | |
| 14483 | } | ||
| 14484 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc26),f,keepdata)) |
| 14485 | { | ||
| 14486 | ✗ | return qe_invalid; | |
| 14487 | } | ||
| 14488 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc27),f,keepdata)) |
| 14489 | { | ||
| 14490 | ✗ | return qe_invalid; | |
| 14491 | } | ||
| 14492 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc28),f,keepdata)) |
| 14493 | { | ||
| 14494 | ✗ | return qe_invalid; | |
| 14495 | } | ||
| 14496 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc29),f,keepdata)) |
| 14497 | { | ||
| 14498 | ✗ | return qe_invalid; | |
| 14499 | } | ||
| 14500 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc30),f,keepdata)) |
| 14501 | { | ||
| 14502 | ✗ | return qe_invalid; | |
| 14503 | } | ||
| 14504 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc31),f,keepdata)) |
| 14505 | { | ||
| 14506 | ✗ | return qe_invalid; | |
| 14507 | } | ||
| 14508 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc32),f,keepdata)) |
| 14509 | { | ||
| 14510 | ✗ | return qe_invalid; | |
| 14511 | } | ||
| 14512 | |||
| 14513 |
2/2✓ Branch 0 taken 131072 times.
✓ Branch 1 taken 4096 times.
|
135168 | for ( int32_t q = 0; q < 32; q++ ) { |
| 14514 |
1/2✓ Branch 0 taken 131072 times.
✗ Branch 1 not taken.
|
131072 | if(!p_igetl(&(tempguy.movement[q]),f,keepdata)) |
| 14515 | { | ||
| 14516 | ✗ | return qe_invalid; | |
| 14517 | } | ||
| 14518 | 131072 | } | |
| 14519 |
2/2✓ Branch 0 taken 131072 times.
✓ Branch 1 taken 4096 times.
|
135168 | for ( int32_t q = 0; q < 32; q++ ) { |
| 14520 |
1/2✓ Branch 0 taken 131072 times.
✗ Branch 1 not taken.
|
131072 | if(!p_igetl(&(tempguy.new_weapon[q]),f,keepdata)) |
| 14521 | { | ||
| 14522 | ✗ | return qe_invalid; | |
| 14523 | } | ||
| 14524 | 131072 | } | |
| 14525 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetw(&(tempguy.script),f,keepdata)) |
| 14526 | { | ||
| 14527 | ✗ | return qe_invalid; | |
| 14528 | } | ||
| 14529 | //al_trace("NPC Script ID is: %d\n",tempguy.script); | ||
| 14530 |
2/2✓ Branch 0 taken 32768 times.
✓ Branch 1 taken 4096 times.
|
36864 | for ( int32_t q = 0; q < 8; q++ ) |
| 14531 | { | ||
| 14532 |
1/2✓ Branch 0 taken 32768 times.
✗ Branch 1 not taken.
|
32768 | if(!p_igetl(&(tempguy.initD[q]),f,keepdata)) |
| 14533 | { | ||
| 14534 | ✗ | return qe_invalid; | |
| 14535 | } | ||
| 14536 | 32768 | } | |
| 14537 |
2/2✓ Branch 0 taken 8192 times.
✓ Branch 1 taken 4096 times.
|
12288 | for ( int32_t q = 0; q < 2; q++ ) |
| 14538 | { | ||
| 14539 |
1/2✓ Branch 0 taken 8192 times.
✗ Branch 1 not taken.
|
8192 | if(!p_igetl(&(tempguy.initA[q]),f,keepdata)) |
| 14540 | { | ||
| 14541 | ✗ | return qe_invalid; | |
| 14542 | } | ||
| 14543 | 8192 | } | |
| 14544 | |||
| 14545 | 4096 | } | |
| 14546 | |||
| 14547 |
2/2✓ Branch 0 taken 35328 times.
✓ Branch 1 taken 4096 times.
|
39424 | if(guyversion >= 37) |
| 14548 | { | ||
| 14549 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.editorflags),f,keepdata)) |
| 14550 | { | ||
| 14551 | ✗ | return qe_invalid; | |
| 14552 | } | ||
| 14553 | 4096 | } | |
| 14554 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if ( guyversion < 37 ) { tempguy.editorflags = 0; } |
| 14555 |
2/2✓ Branch 0 taken 35328 times.
✓ Branch 1 taken 4096 times.
|
39424 | if(guyversion >= 38) |
| 14556 | { | ||
| 14557 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc13),f,keepdata)) |
| 14558 | { | ||
| 14559 | ✗ | return qe_invalid; | |
| 14560 | } | ||
| 14561 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc14),f,keepdata)) |
| 14562 | { | ||
| 14563 | ✗ | return qe_invalid; | |
| 14564 | } | ||
| 14565 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetl(&(tempguy.misc15),f,keepdata)) |
| 14566 | { | ||
| 14567 | ✗ | return qe_invalid; | |
| 14568 | } | ||
| 14569 | |||
| 14570 | 4096 | } | |
| 14571 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if ( guyversion < 38 ) |
| 14572 | { | ||
| 14573 | 35328 | tempguy.misc13 = 0; | |
| 14574 | 35328 | tempguy.misc14 = 0; | |
| 14575 | 35328 | tempguy.misc15 = 0; | |
| 14576 | 35328 | } | |
| 14577 | |||
| 14578 |
2/2✓ Branch 0 taken 35328 times.
✓ Branch 1 taken 4096 times.
|
39424 | if ( guyversion >= 39 ) |
| 14579 | { | ||
| 14580 |
2/2✓ Branch 0 taken 32768 times.
✓ Branch 1 taken 4096 times.
|
36864 | for ( int32_t q = 0; q < 8; q++ ) |
| 14581 | { | ||
| 14582 |
2/2✓ Branch 0 taken 2129920 times.
✓ Branch 1 taken 32768 times.
|
2162688 | for ( int32_t w = 0; w < 65; w++ ) |
| 14583 | { | ||
| 14584 |
1/2✓ Branch 0 taken 2129920 times.
✗ Branch 1 not taken.
|
2129920 | if(!p_getc(&(tempguy.initD_label[q][w]),f,keepdata)) |
| 14585 | { | ||
| 14586 | ✗ | return qe_invalid; | |
| 14587 | } | ||
| 14588 | 2129920 | } | |
| 14589 |
2/2✓ Branch 0 taken 2129920 times.
✓ Branch 1 taken 32768 times.
|
2162688 | for ( int32_t w = 0; w < 65; w++ ) |
| 14590 | { | ||
| 14591 |
1/2✓ Branch 0 taken 2129920 times.
✗ Branch 1 not taken.
|
2129920 | if(!p_getc(&(tempguy.weapon_initD_label[q][w]),f,keepdata)) |
| 14592 | { | ||
| 14593 | ✗ | return qe_invalid; | |
| 14594 | } | ||
| 14595 | 2129920 | } | |
| 14596 | 32768 | } | |
| 14597 | |||
| 14598 | |||
| 14599 | 4096 | } | |
| 14600 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if ( guyversion < 39 ) //apply old InitD strings to both |
| 14601 | { | ||
| 14602 |
2/2✓ Branch 0 taken 282624 times.
✓ Branch 1 taken 35328 times.
|
317952 | for ( int32_t q = 0; q < 8; q++ ) |
| 14603 | { | ||
| 14604 | 282624 | sprintf(tempguy.initD_label[q],"InitD[%d]",q); | |
| 14605 | 282624 | sprintf(tempguy.weapon_initD_label[q],"InitD[%d]",q); | |
| 14606 | 282624 | } | |
| 14607 | 35328 | } | |
| 14608 |
2/2✓ Branch 0 taken 35328 times.
✓ Branch 1 taken 4096 times.
|
39424 | if ( guyversion >= 40 ) |
| 14609 | { | ||
| 14610 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_igetw(&(tempguy.weaponscript),f,keepdata)) |
| 14611 | { | ||
| 14612 | ✗ | return qe_invalid; | |
| 14613 | } | ||
| 14614 | 4096 | } | |
| 14615 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if ( guyversion < 40 ) |
| 14616 | { | ||
| 14617 | 35328 | tempguy.weaponscript = 0; | |
| 14618 | 35328 | } | |
| 14619 | //eweapon script InitD | ||
| 14620 |
2/2✓ Branch 0 taken 35328 times.
✓ Branch 1 taken 4096 times.
|
39424 | if ( guyversion >= 41 ) |
| 14621 | { | ||
| 14622 |
2/2✓ Branch 0 taken 32768 times.
✓ Branch 1 taken 4096 times.
|
36864 | for ( int32_t q = 0; q < 8; q++ ) |
| 14623 | { | ||
| 14624 |
1/2✓ Branch 0 taken 32768 times.
✗ Branch 1 not taken.
|
32768 | if(!p_igetl(&(tempguy.weap_initiald[q]),f,keepdata)) |
| 14625 | { | ||
| 14626 | ✗ | return qe_invalid; | |
| 14627 | } | ||
| 14628 | 32768 | } | |
| 14629 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if ( guy_cversion < 4 ) |
| 14630 | { | ||
| 14631 | ✗ | if ( tempguy.family == eeKEESE ) | |
| 14632 | { | ||
| 14633 | |||
| 14634 | ✗ | if ( !tempguy.misc1 ) | |
| 14635 | { | ||
| 14636 | ✗ | tempguy.misc16 = 120; | |
| 14637 | ✗ | tempguy.misc17 = 16; | |
| 14638 | |||
| 14639 | } | ||
| 14640 | } | ||
| 14641 | ✗ | if ( tempguy.family == eePEAHAT ) | |
| 14642 | { | ||
| 14643 | ✗ | tempguy.misc16 = 80; | |
| 14644 | ✗ | tempguy.misc17 = 16; | |
| 14645 | } | ||
| 14646 | |||
| 14647 | ✗ | if ( tempguy.family == eeGHINI ) | |
| 14648 | { | ||
| 14649 | ✗ | tempguy.misc16 = 120; | |
| 14650 | ✗ | tempguy.misc17 = 10; | |
| 14651 | } | ||
| 14652 | |||
| 14653 | } | ||
| 14654 | 4096 | } | |
| 14655 | |||
| 14656 | |||
| 14657 | |||
| 14658 | //default weapon sprites (quest version < 2.54) | ||
| 14659 | //port over old defaults -Z | ||
| 14660 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if(guyversion < 32) |
| 14661 | { | ||
| 14662 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35328 times.
|
35328 | if ( tempguy.wpnsprite <= 0 ) |
| 14663 | { | ||
| 14664 |
16/20✗ Branch 0 not taken.
✓ Branch 1 taken 1199 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 29269 times.
✓ Branch 4 taken 273 times.
✓ Branch 5 taken 289 times.
✓ Branch 6 taken 874 times.
✓ Branch 7 taken 447 times.
✓ Branch 8 taken 829 times.
✓ Branch 9 taken 69 times.
✓ Branch 10 taken 18 times.
✓ Branch 11 taken 120 times.
✓ Branch 12 taken 18 times.
✓ Branch 13 taken 337 times.
✓ Branch 14 taken 689 times.
✓ Branch 15 taken 99 times.
✓ Branch 16 taken 69 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 729 times.
|
35328 | switch(tempguy.weapon) |
| 14665 | { | ||
| 14666 | case wNone: | ||
| 14667 | 29269 | tempguy.wpnsprite = 0; break; | |
| 14668 | |||
| 14669 | case wSword: | ||
| 14670 | case wBeam: | ||
| 14671 | case wBrang: | ||
| 14672 | case wBomb: | ||
| 14673 | case wSBomb: | ||
| 14674 | case wLitBomb: | ||
| 14675 | case wLitSBomb: | ||
| 14676 | case wArrow: | ||
| 14677 | case wFire: | ||
| 14678 | case wWhistle: | ||
| 14679 | case wBait: | ||
| 14680 | case wWand: | ||
| 14681 | case wMagic: | ||
| 14682 | case wCatching: | ||
| 14683 | case wWind: | ||
| 14684 | case wRefMagic: | ||
| 14685 | case wRefFireball: | ||
| 14686 | case wRefRock: | ||
| 14687 | case wHammer: | ||
| 14688 | case wHookshot: | ||
| 14689 | case wHSHandle: | ||
| 14690 | case wHSChain: | ||
| 14691 | case wSSparkle: | ||
| 14692 | case wFSparkle: | ||
| 14693 | case wSmack: | ||
| 14694 | case wPhantom: | ||
| 14695 | case wCByrna: | ||
| 14696 | case wRefBeam: | ||
| 14697 | case wStomp: | ||
| 14698 | case lwMax: | ||
| 14699 | case wScript1: | ||
| 14700 | case wScript2: | ||
| 14701 | case wScript3: | ||
| 14702 | case wScript4: | ||
| 14703 | case wScript5: | ||
| 14704 | case wScript6: | ||
| 14705 | case wScript7: | ||
| 14706 | case wScript8: | ||
| 14707 | case wScript9: | ||
| 14708 | case wScript10: | ||
| 14709 | case wIce: | ||
| 14710 | //Cannot use any of these weapons yet. | ||
| 14711 | ✗ | tempguy.wpnsprite = -1; | |
| 14712 | ✗ | break; | |
| 14713 | |||
| 14714 | case wEnemyWeapons: | ||
| 14715 | 1199 | case ewFireball: tempguy.wpnsprite = 17; break; | |
| 14716 | |||
| 14717 | 273 | case ewArrow: tempguy.wpnsprite = 19; break; | |
| 14718 | 289 | case ewBrang: tempguy.wpnsprite = 4; break; | |
| 14719 | 874 | case ewSword: tempguy.wpnsprite = 20; break; | |
| 14720 | 447 | case ewRock: tempguy.wpnsprite = 18; break; | |
| 14721 | 829 | case ewMagic: tempguy.wpnsprite = 21; break; | |
| 14722 | 69 | case ewBomb: tempguy.wpnsprite = 78; break; | |
| 14723 | 18 | case ewSBomb: tempguy.wpnsprite = 79; break; | |
| 14724 | 120 | case ewLitBomb: tempguy.wpnsprite = 76; break; | |
| 14725 | 18 | case ewLitSBomb: tempguy.wpnsprite = 77; break; | |
| 14726 | 337 | case ewFireTrail: tempguy.wpnsprite = 80; break; | |
| 14727 | 689 | case ewFlame: tempguy.wpnsprite = 35; break; | |
| 14728 | 99 | case ewWind: tempguy.wpnsprite = 36; break; | |
| 14729 | 69 | case ewFlame2: tempguy.wpnsprite = 81; break; | |
| 14730 | ✗ | case ewFlame2Trail: tempguy.wpnsprite = 82; break; | |
| 14731 | ✗ | case ewIce: tempguy.wpnsprite = 83; break; | |
| 14732 | 729 | case ewFireball2: tempguy.wpnsprite = 17; break; //fireball (rising) | |
| 14733 | |||
| 14734 | |||
| 14735 | ✗ | default: break; //No assign. | |
| 14736 | } | ||
| 14737 | 35328 | } | |
| 14738 | 35328 | } | |
| 14739 | |||
| 14740 | //default weapon fire sound (quest version < 2.54) | ||
| 14741 | //port over old defaults and zero new data. -Z | ||
| 14742 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if(guyversion < 34) |
| 14743 | { | ||
| 14744 |
2/2✓ Branch 0 taken 1130496 times.
✓ Branch 1 taken 35328 times.
|
1165824 | for ( int32_t q = 0; q < 32; q++ ) |
| 14745 | { | ||
| 14746 | 1130496 | tempguy.movement[q] = 0; | |
| 14747 | 1130496 | tempguy.new_weapon[q] = 0; | |
| 14748 | |||
| 14749 | 1130496 | } | |
| 14750 | |||
| 14751 | //NPC Script attributes. | ||
| 14752 | 35328 | tempguy.script = 0; //No scripted enemies existed. -Z | |
| 14753 |
2/2✓ Branch 0 taken 282624 times.
✓ Branch 1 taken 35328 times.
|
317952 | for ( int32_t q = 0; q < 8; q++ ) tempguy.initD[q] = 0; //Script Data |
| 14754 |
2/2✓ Branch 0 taken 70656 times.
✓ Branch 1 taken 35328 times.
|
105984 | for ( int32_t q = 0; q < 2; q++ ) tempguy.initA[q] = 0; //Script Data |
| 14755 | |||
| 14756 | 35328 | tempguy.misc16 = 0; | |
| 14757 | 35328 | tempguy.misc17 = 0; | |
| 14758 | 35328 | tempguy.misc18 = 0; | |
| 14759 | 35328 | tempguy.misc19 = 0; | |
| 14760 | 35328 | tempguy.misc20 = 0; | |
| 14761 | 35328 | tempguy.misc21 = 0; | |
| 14762 | 35328 | tempguy.misc22 = 0; | |
| 14763 | 35328 | tempguy.misc23 = 0; | |
| 14764 | 35328 | tempguy.misc24 = 0; | |
| 14765 | 35328 | tempguy.misc25 = 0; | |
| 14766 | 35328 | tempguy.misc26 = 0; | |
| 14767 | 35328 | tempguy.misc27 = 0; | |
| 14768 | 35328 | tempguy.misc28 = 0; | |
| 14769 | 35328 | tempguy.misc29 = 0; | |
| 14770 | 35328 | tempguy.misc30 = 0; | |
| 14771 | 35328 | tempguy.misc31 = 0; | |
| 14772 | 35328 | tempguy.misc32 = 0; | |
| 14773 | |||
| 14774 | //old default sounds | ||
| 14775 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35328 times.
|
35328 | if ( tempguy.firesfx <= 0 ) |
| 14776 | { | ||
| 14777 |
16/20✗ Branch 0 not taken.
✓ Branch 1 taken 1199 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 29269 times.
✓ Branch 4 taken 273 times.
✓ Branch 5 taken 289 times.
✓ Branch 6 taken 874 times.
✓ Branch 7 taken 447 times.
✓ Branch 8 taken 829 times.
✓ Branch 9 taken 69 times.
✓ Branch 10 taken 18 times.
✓ Branch 11 taken 120 times.
✓ Branch 12 taken 18 times.
✓ Branch 13 taken 337 times.
✓ Branch 14 taken 689 times.
✓ Branch 15 taken 99 times.
✓ Branch 16 taken 69 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 729 times.
|
35328 | switch(tempguy.weapon) |
| 14778 | { | ||
| 14779 | case wNone: | ||
| 14780 | 29269 | tempguy.firesfx = 0; break; | |
| 14781 | |||
| 14782 | case wSword: | ||
| 14783 | case wBeam: | ||
| 14784 | case wBrang: | ||
| 14785 | case wBomb: | ||
| 14786 | case wSBomb: | ||
| 14787 | case wLitBomb: | ||
| 14788 | case wLitSBomb: | ||
| 14789 | case wArrow: | ||
| 14790 | case wFire: | ||
| 14791 | case wWhistle: | ||
| 14792 | case wBait: | ||
| 14793 | case wWand: | ||
| 14794 | case wMagic: | ||
| 14795 | case wCatching: | ||
| 14796 | case wWind: | ||
| 14797 | case wRefMagic: | ||
| 14798 | case wRefFireball: | ||
| 14799 | case wRefRock: | ||
| 14800 | case wHammer: | ||
| 14801 | case wHookshot: | ||
| 14802 | case wHSHandle: | ||
| 14803 | case wHSChain: | ||
| 14804 | case wSSparkle: | ||
| 14805 | case wFSparkle: | ||
| 14806 | case wSmack: | ||
| 14807 | case wPhantom: | ||
| 14808 | case wCByrna: | ||
| 14809 | case wRefBeam: | ||
| 14810 | case wStomp: | ||
| 14811 | case lwMax: | ||
| 14812 | case wScript1: | ||
| 14813 | case wScript2: | ||
| 14814 | case wScript3: | ||
| 14815 | case wScript4: | ||
| 14816 | case wScript5: | ||
| 14817 | case wScript6: | ||
| 14818 | case wScript7: | ||
| 14819 | case wScript8: | ||
| 14820 | case wScript9: | ||
| 14821 | case wScript10: | ||
| 14822 | case wIce: | ||
| 14823 | //Cannot use any of these weapons yet. | ||
| 14824 | ✗ | tempguy.firesfx = -1; | |
| 14825 | ✗ | break; | |
| 14826 | |||
| 14827 | case wEnemyWeapons: | ||
| 14828 | 1199 | case ewFireball: tempguy.firesfx = 40; break; | |
| 14829 | |||
| 14830 | 273 | case ewArrow: tempguy.firesfx = 1; break; //Ghost.zh has 0? | |
| 14831 | 289 | case ewBrang: tempguy.firesfx = 4; break; //Ghost.zh has 0? | |
| 14832 | 874 | case ewSword: tempguy.firesfx = 20; break; //Ghost.zh has 0? | |
| 14833 | 447 | case ewRock: tempguy.firesfx = 51; break; | |
| 14834 | 829 | case ewMagic: tempguy.firesfx = 32; break; | |
| 14835 | 69 | case ewBomb: tempguy.firesfx = 3; break; //Ghost.zh has 0? | |
| 14836 | 18 | case ewSBomb: tempguy.firesfx = 3; break; //Ghost.zh has 0? | |
| 14837 | 120 | case ewLitBomb: tempguy.firesfx = 21; break; //Ghost.zh has 0? | |
| 14838 | 18 | case ewLitSBomb: tempguy.firesfx = 21; break; //Ghost.zh has 0? | |
| 14839 | 337 | case ewFireTrail: tempguy.firesfx = 13; break; | |
| 14840 | 689 | case ewFlame: tempguy.firesfx = 13; break; | |
| 14841 | 99 | case ewWind: tempguy.firesfx = 32; break; | |
| 14842 | 69 | case ewFlame2: tempguy.firesfx = 13; break; | |
| 14843 | ✗ | case ewFlame2Trail: tempguy.firesfx = 13; break; | |
| 14844 | ✗ | case ewIce: tempguy.firesfx = 44; break; | |
| 14845 | 729 | case ewFireball2: tempguy.firesfx = 40; break; //fireball (rising) | |
| 14846 | |||
| 14847 | //what about special attacks (e.g. summoning == 56) | ||
| 14848 | ✗ | default: break; //No assign. | |
| 14849 | } | ||
| 14850 | 35328 | } | |
| 14851 | 35328 | } | |
| 14852 | |||
| 14853 | //Port hardcoded hit sound to the enemy hitsfx defaults for older quests. | ||
| 14854 |
4/6✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
✓ Branch 2 taken 4096 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4096 times.
|
39424 | if(Header->zelda_version <= 0x250 || ( Header->zelda_version > 0x250 && guyversion < 35 )) |
| 14855 | { | ||
| 14856 |
2/2✓ Branch 0 taken 2878 times.
✓ Branch 1 taken 32450 times.
|
35328 | if ( tempguy.hitsfx == 0 ) tempguy.hitsfx = 11; |
| 14857 | 35328 | } | |
| 14858 | //Keese and bat halt rates. | ||
| 14859 |
3/4✓ Branch 0 taken 35328 times.
✓ Branch 1 taken 4096 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 35328 times.
|
39424 | if ( guyversion < 42 && guy_cversion < 4 ) |
| 14860 | { | ||
| 14861 | |||
| 14862 |
2/2✓ Branch 0 taken 34843 times.
✓ Branch 1 taken 485 times.
|
35328 | if ( tempguy.family == eeKEESE ) |
| 14863 | { | ||
| 14864 | |||
| 14865 |
2/2✓ Branch 0 taken 191 times.
✓ Branch 1 taken 294 times.
|
485 | if ( !tempguy.misc1 ) |
| 14866 | { | ||
| 14867 | 294 | tempguy.misc16 = 120; | |
| 14868 | 294 | tempguy.misc17 = 16; | |
| 14869 | |||
| 14870 | 294 | } | |
| 14871 | 485 | } | |
| 14872 |
2/2✓ Branch 0 taken 35175 times.
✓ Branch 1 taken 153 times.
|
35328 | if ( tempguy.family == eePEAHAT ) |
| 14873 | { | ||
| 14874 | 153 | tempguy.misc16 = 80; | |
| 14875 | 153 | tempguy.misc17 = 16; | |
| 14876 | 153 | } | |
| 14877 |
2/2✓ Branch 0 taken 35259 times.
✓ Branch 1 taken 69 times.
|
35328 | if ( tempguy.family == eeGHINI ) |
| 14878 | { | ||
| 14879 | 69 | tempguy.misc16 = 120; | |
| 14880 | 69 | tempguy.misc17 = 10; | |
| 14881 | 69 | } | |
| 14882 | |||
| 14883 | |||
| 14884 | 35328 | } | |
| 14885 | |||
| 14886 | |||
| 14887 | //miscellaneous other corrections | ||
| 14888 | //fix the mirror wizzrobe -DD | ||
| 14889 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(guyversion < 7) |
| 14890 | { | ||
| 14891 | ✗ | if(i == eMWIZ) | |
| 14892 | { | ||
| 14893 | ✗ | tempguy.misc2 = 0; | |
| 14894 | ✗ | tempguy.misc4 = 1; | |
| 14895 | } | ||
| 14896 | } | ||
| 14897 | |||
| 14898 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(guyversion < 8) |
| 14899 | { | ||
| 14900 | ✗ | if(i == eGLEEOK1 || i == eGLEEOK2 || i == eGLEEOK3 || i == eGLEEOK4 || i == eGLEEOK1F || i == eGLEEOK2F || i == eGLEEOK3F || i == eGLEEOK4F) | |
| 14901 | { | ||
| 14902 | // Some of these are deliberately different to NewDefault/defdata.cpp, by the way. -L | ||
| 14903 | ✗ | tempguy.misc5 = 4; //neck length in segments | |
| 14904 | ✗ | tempguy.misc6 = 8; //neck offset from first body tile | |
| 14905 | ✗ | tempguy.misc7 = 40; //offset for each subsequent neck tile from the first neck tile | |
| 14906 | ✗ | tempguy.misc8 = 168; //head offset from first body tile | |
| 14907 | ✗ | tempguy.misc9 = 228; //flying head offset from first body tile | |
| 14908 | |||
| 14909 | ✗ | if(i == eGLEEOK1F || i == eGLEEOK2F || i == eGLEEOK3F || i == eGLEEOK4F) | |
| 14910 | { | ||
| 14911 | ✗ | tempguy.misc6 += 10; //neck offset from first body tile | |
| 14912 | ✗ | tempguy.misc8 -= 12; //head offset from first body tile | |
| 14913 | } | ||
| 14914 | } | ||
| 14915 | } | ||
| 14916 | |||
| 14917 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(guyversion < 10) // December 2007 - Dodongo CSet fix |
| 14918 | { | ||
| 14919 | ✗ | if(get_bit(deprecated_rules,46) && tempguy.family==eeDONGO && tempguy.misc1==0) | |
| 14920 | ✗ | tempguy.bosspal = spDIG; | |
| 14921 | } | ||
| 14922 | |||
| 14923 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(guyversion < 11) // December 2007 - Spinning Tile fix |
| 14924 | { | ||
| 14925 | ✗ | if(tempguy.family==eeSPINTILE) | |
| 14926 | { | ||
| 14927 | ✗ | tempguy.flags |= guy_superman; | |
| 14928 | ✗ | tempguy.item_set = 0; // Don't drop items | |
| 14929 | ✗ | tempguy.step = 300; | |
| 14930 | } | ||
| 14931 | } | ||
| 14932 | |||
| 14933 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(guyversion < 12) // October 2008 - Flashing Bubble, Rope 2, and Ghini 2 fix |
| 14934 | { | ||
| 14935 | ✗ | if(get_bit(deprecated_rules, qr_NOROPE2FLASH_DEP)) | |
| 14936 | { | ||
| 14937 | ✗ | if(tempguy.family==eeROPE) | |
| 14938 | { | ||
| 14939 | ✗ | tempguy.flags2 &= ~guy_flashing; | |
| 14940 | } | ||
| 14941 | } | ||
| 14942 | |||
| 14943 | ✗ | if(get_bit(deprecated_rules, qr_NOBUBBLEFLASH_DEP)) | |
| 14944 | { | ||
| 14945 | ✗ | if(tempguy.family==eeBUBBLE) | |
| 14946 | { | ||
| 14947 | ✗ | tempguy.flags2 &= ~guy_flashing; | |
| 14948 | } | ||
| 14949 | } | ||
| 14950 | |||
| 14951 | ✗ | if((tempguy.family==eeGHINI)&&(tempguy.misc1)) | |
| 14952 | { | ||
| 14953 | ✗ | if(get_bit(deprecated_rules, qr_GHINI2BLINK_DEP)) | |
| 14954 | { | ||
| 14955 | ✗ | tempguy.flags2 |= guy_blinking; | |
| 14956 | } | ||
| 14957 | |||
| 14958 | ✗ | if(get_bit(deprecated_rules, qr_PHANTOMGHINI2_DEP)) | |
| 14959 | { | ||
| 14960 | ✗ | tempguy.flags2 |= guy_transparent; | |
| 14961 | } | ||
| 14962 | } | ||
| 14963 | } | ||
| 14964 | |||
| 14965 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(guyversion < 15) // July 2009 - Guy Fire and Fairy fix |
| 14966 | { | ||
| 14967 | ✗ | if(i==gFIRE) | |
| 14968 | { | ||
| 14969 | ✗ | tempguy.e_anim = aFLIP; | |
| 14970 | ✗ | tempguy.e_frate = 24; | |
| 14971 | } | ||
| 14972 | |||
| 14973 | ✗ | if(i==gFAIRY) | |
| 14974 | { | ||
| 14975 | ✗ | tempguy.e_anim = a2FRM; | |
| 14976 | ✗ | tempguy.e_frate = 16; | |
| 14977 | } | ||
| 14978 | } | ||
| 14979 | |||
| 14980 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(guyversion < 16) // November 2009 - Super Enemy Editor part 1 |
| 14981 | { | ||
| 14982 | ✗ | if(i==0) Z_message("Updating guys to version 16...\n"); | |
| 14983 | |||
| 14984 | ✗ | update_guy_1(&tempguy); | |
| 14985 | |||
| 14986 | ✗ | if(i==eMPOLSV) | |
| 14987 | { | ||
| 14988 | ✗ | tempguy.defense[edefARROW] = edCHINK; | |
| 14989 | ✗ | tempguy.defense[edefMAGIC] = ed1HKO; | |
| 14990 | ✗ | tempguy.defense[edefREFMAGIC] = ed1HKO; | |
| 14991 | } | ||
| 14992 | } | ||
| 14993 | |||
| 14994 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(guyversion < 17) // December 2009 |
| 14995 | { | ||
| 14996 | ✗ | if(tempguy.family==eePROJECTILE) | |
| 14997 | { | ||
| 14998 | ✗ | tempguy.misc1 = 0; | |
| 14999 | } | ||
| 15000 | } | ||
| 15001 | |||
| 15002 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(guyversion < 18) // January 2010 |
| 15003 | { | ||
| 15004 | ✗ | bool boss = (tempguy.family == eeAQUA || tempguy.family==eeDONGO || tempguy.family == eeMANHAN || tempguy.family == eeGHOMA || tempguy.family==eeDIG | |
| 15005 | ✗ | || tempguy.family == eeGLEEOK || tempguy.family==eePATRA || tempguy.family == eeGANON || tempguy.family==eeMOLD); | |
| 15006 | |||
| 15007 | ✗ | tempguy.hitsfx = (boss && tempguy.family != eeMOLD && tempguy.family != eeDONGO && tempguy.family != eeDIG) ? WAV_GASP : 0; | |
| 15008 | ✗ | tempguy.deadsfx = (boss && (tempguy.family != eeDIG || tempguy.misc10 == 0)) ? WAV_GASP : WAV_EDEAD; | |
| 15009 | |||
| 15010 | ✗ | if(tempguy.family == eeAQUA) | |
| 15011 | ✗ | for(int32_t j=0; j<edefLAST; j++) tempguy.defense[j] = default_guys[eRAQUAM].defense[j]; | |
| 15012 | ✗ | else if(tempguy.family == eeMANHAN) | |
| 15013 | ✗ | for(int32_t j=0; j<edefLAST; j++) tempguy.defense[j] = default_guys[eMANHAN].defense[j]; | |
| 15014 | ✗ | else if(tempguy.family==eePATRA) | |
| 15015 | ✗ | for(int32_t j=0; j<edefLAST; j++) tempguy.defense[j] = default_guys[eGLEEOK1].defense[j]; | |
| 15016 | ✗ | else if(tempguy.family==eeGHOMA) | |
| 15017 | { | ||
| 15018 | ✗ | for(int32_t j=0; j<edefLAST; j++) | |
| 15019 | ✗ | tempguy.defense[j] = default_guys[eGOHMA1].defense[j]; | |
| 15020 | |||
| 15021 | ✗ | tempguy.defense[edefARROW] = ((tempguy.misc1==3) ? edCHINKL8 : (tempguy.misc1==2) ? edCHINKL4 : 0); | |
| 15022 | |||
| 15023 | ✗ | if(tempguy.misc1==3 && !tempguy.weapon) tempguy.weapon = ewFlame; | |
| 15024 | |||
| 15025 | ✗ | tempguy.misc1--; | |
| 15026 | } | ||
| 15027 | ✗ | else if(tempguy.family == eeGLEEOK) | |
| 15028 | { | ||
| 15029 | ✗ | for(int32_t j=0; j<edefLAST; j++) | |
| 15030 | ✗ | tempguy.defense[j] = default_guys[eGLEEOK1].defense[j]; | |
| 15031 | |||
| 15032 | ✗ | if(tempguy.misc3==1 && !tempguy.weapon) tempguy.weapon = ewFlame; | |
| 15033 | } | ||
| 15034 | ✗ | else if(tempguy.family == eeARMOS) | |
| 15035 | { | ||
| 15036 | ✗ | tempguy.family=eeWALK; | |
| 15037 | ✗ | tempguy.hrate = 0; | |
| 15038 | ✗ | tempguy.misc10 = tempguy.misc1; | |
| 15039 | ✗ | tempguy.misc1 = tempguy.misc2 = tempguy.misc3 = tempguy.misc4 = tempguy.misc5 = tempguy.misc6 = tempguy.misc7 = tempguy.misc8 = 0; | |
| 15040 | ✗ | tempguy.misc9 = e9tARMOS; | |
| 15041 | } | ||
| 15042 | ✗ | else if(tempguy.family == eeGHINI && !tempguy.misc1) | |
| 15043 | { | ||
| 15044 | ✗ | tempguy.family=eeWALK; | |
| 15045 | ✗ | tempguy.hrate = 0; | |
| 15046 | ✗ | tempguy.misc1 = tempguy.misc2 = tempguy.misc3 = tempguy.misc4 = tempguy.misc5 = tempguy.misc6 = | |
| 15047 | ✗ | tempguy.misc7 = tempguy.misc8 = tempguy.misc9 = tempguy.misc10 = 0; | |
| 15048 | } | ||
| 15049 | |||
| 15050 | // Spawn animation flags | ||
| 15051 | ✗ | if(tempguy.family == eeWALK && (tempguy.flags2&cmbflag_armos || tempguy.flags2&cmbflag_ghini)) | |
| 15052 | ✗ | tempguy.flags |= guy_fadeflicker; | |
| 15053 | else | ||
| 15054 | ✗ | tempguy.flags &= 0x0F00000F; // Get rid of the unused flags! | |
| 15055 | } | ||
| 15056 | |||
| 15057 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(guyversion < 20) // April 2010 |
| 15058 | { | ||
| 15059 | ✗ | if(tempguy.family == eeTRAP) | |
| 15060 | { | ||
| 15061 | ✗ | tempguy.misc2 = tempguy.misc10; | |
| 15062 | |||
| 15063 | ✗ | if(tempguy.misc10>=1) | |
| 15064 | { | ||
| 15065 | ✗ | tempguy.misc1++; | |
| 15066 | } | ||
| 15067 | |||
| 15068 | ✗ | tempguy.misc10 = 0; | |
| 15069 | } | ||
| 15070 | |||
| 15071 | // Bomb Blast fix | ||
| 15072 | ✗ | if(tempguy.weapon==ewBomb && tempguy.family!=eeROPE && (tempguy.family!=eeWALK || tempguy.misc2 != e2tBOMBCHU)) | |
| 15073 | ✗ | tempguy.weapon = ewLitBomb; | |
| 15074 | ✗ | else if(tempguy.weapon==ewSBomb && tempguy.family!=eeROPE && (tempguy.family!=eeWALK || tempguy.misc2 != e2tBOMBCHU)) | |
| 15075 | ✗ | tempguy.weapon = ewLitSBomb; | |
| 15076 | } | ||
| 15077 | |||
| 15078 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(guyversion < 21) // September 2011 |
| 15079 | { | ||
| 15080 | ✗ | if(tempguy.family == eeKEESE || tempguy.family == eeKEESETRIB) | |
| 15081 | { | ||
| 15082 | ✗ | if(tempguy.family == eeKEESETRIB) | |
| 15083 | { | ||
| 15084 | ✗ | tempguy.family = eeKEESE; | |
| 15085 | ✗ | tempguy.misc2 = e2tKEESETRIB; | |
| 15086 | ✗ | tempguy.misc1 = 0; | |
| 15087 | } | ||
| 15088 | |||
| 15089 | ✗ | tempguy.rate = 2; | |
| 15090 | ✗ | tempguy.hrate = 8; | |
| 15091 | ✗ | tempguy.homing = 0; | |
| 15092 | ✗ | tempguy.step= (tempguy.family == eeKEESE && tempguy.misc1 ? 100:62); | |
| 15093 | } | ||
| 15094 | ✗ | else if(tempguy.family == eePEAHAT || tempguy.family==eePATRA) | |
| 15095 | { | ||
| 15096 | ✗ | if(tempguy.family == eePEAHAT) | |
| 15097 | { | ||
| 15098 | ✗ | tempguy.rate = 4; | |
| 15099 | ✗ | tempguy.step = 62; | |
| 15100 | } | ||
| 15101 | else | ||
| 15102 | ✗ | tempguy.step = 25; | |
| 15103 | |||
| 15104 | ✗ | tempguy.hrate = 8; | |
| 15105 | ✗ | tempguy.homing = 0; | |
| 15106 | } | ||
| 15107 | ✗ | else if(tempguy.family == eeDIG || tempguy.family == eeMANHAN) | |
| 15108 | { | ||
| 15109 | ✗ | if(tempguy.family == eeMANHAN) | |
| 15110 | ✗ | tempguy.step=50; | |
| 15111 | |||
| 15112 | ✗ | tempguy.hrate = 16; | |
| 15113 | ✗ | tempguy.homing = 0; | |
| 15114 | } | ||
| 15115 | ✗ | else if(tempguy.family == eeGLEEOK) | |
| 15116 | { | ||
| 15117 | ✗ | tempguy.rate = 2; | |
| 15118 | ✗ | tempguy.homing = 0; | |
| 15119 | ✗ | tempguy.hrate = 9; | |
| 15120 | ✗ | tempguy.step=89; | |
| 15121 | } | ||
| 15122 | ✗ | else if(tempguy.family == eeGHINI) | |
| 15123 | { | ||
| 15124 | ✗ | tempguy.rate = 4; | |
| 15125 | ✗ | tempguy.hrate = 12; | |
| 15126 | ✗ | tempguy.step=62; | |
| 15127 | ✗ | tempguy.homing = 0; | |
| 15128 | } | ||
| 15129 | |||
| 15130 | // Bigdig random rate fix | ||
| 15131 | ✗ | if(tempguy.family==eeDIG && tempguy.misc10==1) | |
| 15132 | { | ||
| 15133 | ✗ | tempguy.rate = 2; | |
| 15134 | } | ||
| 15135 | } | ||
| 15136 | |||
| 15137 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(guyversion < 24) // November 2012 |
| 15138 | { | ||
| 15139 | ✗ | if(tempguy.family==eeLANM) | |
| 15140 | ✗ | tempguy.misc3 = 1; | |
| 15141 | ✗ | else if(tempguy.family==eeMOLD) | |
| 15142 | ✗ | tempguy.misc2 = 0; | |
| 15143 | } | ||
| 15144 | |||
| 15145 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if(guyversion < 33) //Whistle defence did not exist before this version of 2.54. -Z |
| 15146 | { | ||
| 15147 |
2/2✓ Branch 0 taken 617 times.
✓ Branch 1 taken 34711 times.
|
35328 | if(tempguy.family!=eeDIG) |
| 15148 | { | ||
| 15149 | 34711 | tempguy.defense[edefWhistle] = edIGNORE; //Might need to be ignore, universally. | |
| 15150 | 34711 | } | |
| 15151 | |||
| 15152 | 35328 | } | |
| 15153 | // does not seem to solve the issue! | ||
| 15154 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if ( Header->zelda_version <= 0x210 ) |
| 15155 | { | ||
| 15156 | ✗ | al_trace("Detected version %d for dodongo patch.\n",Header->zelda_version); | |
| 15157 | ✗ | if ( tempguy.family == eeDONGO ) | |
| 15158 | { | ||
| 15159 | ✗ | tempguy.deadsfx = 15; //In 2.10 and earlier, Dodongos used this as their death sound. | |
| 15160 | } | ||
| 15161 | } | ||
| 15162 | |||
| 15163 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if(guyversion >= 42) |
| 15164 | { | ||
| 15165 |
2/2✓ Branch 0 taken 3584 times.
✓ Branch 1 taken 512 times.
|
4096 | if(guyversion >= 47) |
| 15166 | { | ||
| 15167 |
1/2✓ Branch 0 taken 3584 times.
✗ Branch 1 not taken.
|
3584 | if(!p_igetl(&(tempguy.moveflags),f,keepdata)) |
| 15168 | { | ||
| 15169 | ✗ | return qe_invalid; | |
| 15170 | } | ||
| 15171 | 3584 | } | |
| 15172 | else | ||
| 15173 | { | ||
| 15174 | byte fl; | ||
| 15175 |
1/2✓ Branch 0 taken 512 times.
✗ Branch 1 not taken.
|
512 | if(!p_getc(&fl,f,keepdata)) |
| 15176 | { | ||
| 15177 | ✗ | return qe_invalid; | |
| 15178 | } | ||
| 15179 | 512 | tempguy.moveflags = fl; | |
| 15180 | } | ||
| 15181 | 4096 | } | |
| 15182 | else | ||
| 15183 | { | ||
| 15184 |
7/8✓ Branch 0 taken 75 times.
✓ Branch 1 taken 27740 times.
✓ Branch 2 taken 1127 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 495 times.
✓ Branch 5 taken 258 times.
✓ Branch 6 taken 224 times.
✓ Branch 7 taken 5409 times.
|
35328 | switch(tempguy.family) |
| 15185 | { | ||
| 15186 | //No gravity; floats over pits | ||
| 15187 | case eeTEK: case eePEAHAT: case eeROCK: case eeTRAP: | ||
| 15188 | case eePROJECTILE: case eeSPINTILE: case eeKEESE: case eeFIRE: | ||
| 15189 | //Special (bosses, etc) | ||
| 15190 | case eeFAIRY: case eeGUY: case eeNONE: case eeZORA: | ||
| 15191 | case eeAQUA: case eeDIG: case eeGHOMA: case eeGANON: | ||
| 15192 | case eePATRA: case eeGLEEOK: case eeMOLD: case eeMANHAN: | ||
| 15193 | 27740 | tempguy.moveflags = FLAG_CAN_PITWALK; | |
| 15194 | 27740 | break; | |
| 15195 | //No gravity, but falls in pits | ||
| 15196 | case eeLEV: | ||
| 15197 | 495 | tempguy.moveflags = FLAG_CAN_PITFALL; | |
| 15198 | 495 | break; | |
| 15199 | //Bosses that respect pits | ||
| 15200 | case eeDONGO: | ||
| 15201 | 258 | tempguy.moveflags = FLAG_OBEYS_GRAV; | |
| 15202 | 258 | break; | |
| 15203 | case eeLANM: | ||
| 15204 | 224 | tempguy.moveflags = 0; | |
| 15205 | 224 | break; | |
| 15206 | //Gravity, floats over pits | ||
| 15207 | case eeWIZZ: case eeWALLM: case eeGHINI: | ||
| 15208 | 1127 | tempguy.moveflags = FLAG_OBEYS_GRAV | FLAG_CAN_PITWALK; | |
| 15209 | 1127 | break; | |
| 15210 | //Gravity and falls in pits | ||
| 15211 | case eeWALK: | ||
| 15212 |
4/4✓ Branch 0 taken 5111 times.
✓ Branch 1 taken 298 times.
✓ Branch 2 taken 266 times.
✓ Branch 3 taken 4845 times.
|
5409 | if (tempguy.misc9==e9tPOLSVOICE||tempguy.misc9==e9tVIRE) |
| 15213 | 564 | break; | |
| 15214 | [[fallthrough]]; | ||
| 15215 | case eeOTHER: | ||
| 15216 | case eeSCRIPT01: case eeSCRIPT02: case eeSCRIPT03: case eeSCRIPT04: case eeSCRIPT05: | ||
| 15217 | case eeSCRIPT06: case eeSCRIPT07: case eeSCRIPT08: case eeSCRIPT09: case eeSCRIPT10: | ||
| 15218 | case eeSCRIPT11: case eeSCRIPT12: case eeSCRIPT13: case eeSCRIPT14: case eeSCRIPT15: | ||
| 15219 | case eeSCRIPT16: case eeSCRIPT17: case eeSCRIPT18: case eeSCRIPT19: case eeSCRIPT20: | ||
| 15220 | case eeFFRIENDLY01: case eeFFRIENDLY02: case eeFFRIENDLY03: case eeFFRIENDLY04: case eeFFRIENDLY05: | ||
| 15221 | case eeFFRIENDLY06: case eeFFRIENDLY07: case eeFFRIENDLY08: case eeFFRIENDLY09: case eeFFRIENDLY10: | ||
| 15222 | 4920 | tempguy.moveflags = FLAG_OBEYS_GRAV | FLAG_CAN_PITFALL; | |
| 15223 | 4920 | } | |
| 15224 | } | ||
| 15225 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if(guyversion < 43) |
| 15226 | { | ||
| 15227 |
2/2✓ Branch 0 taken 28867 times.
✓ Branch 1 taken 6461 times.
|
35328 | switch(tempguy.family) |
| 15228 | { | ||
| 15229 | //No gravity; floats over pits | ||
| 15230 | case eeTEK: case eePEAHAT: case eeROCK: case eeTRAP: | ||
| 15231 | case eePROJECTILE: case eeSPINTILE: case eeKEESE: case eeFIRE: | ||
| 15232 | //Special (bosses, etc) | ||
| 15233 | case eeFAIRY: case eeGUY: case eeNONE: case eeZORA: | ||
| 15234 | case eeAQUA: case eeDIG: case eeGHOMA: case eeGANON: | ||
| 15235 | case eePATRA: case eeGLEEOK: case eeMOLD: case eeMANHAN: | ||
| 15236 | case eeWIZZ: case eeWALLM: case eeGHINI: | ||
| 15237 | //Gravity, floats over pits | ||
| 15238 | 28867 | tempguy.moveflags |= FLAG_CAN_WATERWALK; | |
| 15239 | 28867 | break; | |
| 15240 | } | ||
| 15241 | 35328 | } | |
| 15242 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if (guyversion < 44) |
| 15243 | { | ||
| 15244 |
2/2✓ Branch 0 taken 34986 times.
✓ Branch 1 taken 342 times.
|
35328 | if ( tempguy.family == eeGHOMA ) |
| 15245 | { | ||
| 15246 | 342 | tempguy.flags |= guy_fadeinstant; | |
| 15247 | 342 | } | |
| 15248 | 35328 | } | |
| 15249 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if (guyversion > 44) |
| 15250 | { | ||
| 15251 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_getc(&(tempguy.spr_shadow),f,keepdata)) |
| 15252 | { | ||
| 15253 | ✗ | return qe_invalid; | |
| 15254 | } | ||
| 15255 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_getc(&(tempguy.spr_death),f,keepdata)) |
| 15256 | { | ||
| 15257 | ✗ | return qe_invalid; | |
| 15258 | } | ||
| 15259 |
1/2✓ Branch 0 taken 4096 times.
✗ Branch 1 not taken.
|
4096 | if(!p_getc(&(tempguy.spr_spawn),f,keepdata)) |
| 15260 | { | ||
| 15261 | ✗ | return qe_invalid; | |
| 15262 | } | ||
| 15263 | 4096 | } | |
| 15264 | else | ||
| 15265 | { | ||
| 15266 |
2/2✓ Branch 0 taken 35190 times.
✓ Branch 1 taken 138 times.
|
35328 | tempguy.spr_shadow = (tempguy.family==eeROCK && tempguy.misc10==1) ? iwLargeShadow : iwShadow; |
| 15267 | 35328 | tempguy.spr_death = iwDeath; | |
| 15268 | 35328 | tempguy.spr_spawn = iwSpawn; | |
| 15269 | } | ||
| 15270 | |||
| 15271 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 35328 times.
|
39424 | if(guyversion < 46) |
| 15272 | { | ||
| 15273 |
4/4✓ Branch 0 taken 5409 times.
✓ Branch 1 taken 29919 times.
✓ Branch 2 taken 5111 times.
✓ Branch 3 taken 298 times.
|
35328 | if(tempguy.family == eeWALK && tempguy.misc9 == e9tPOLSVOICE) |
| 15274 | { | ||
| 15275 | 298 | tempguy.moveflags |= FLAG_CAN_WATERWALK; | |
| 15276 | 298 | } | |
| 15277 | 35328 | } | |
| 15278 | |||
| 15279 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 39424 times.
|
39424 | if(keepdata) |
| 15280 | { | ||
| 15281 | 39424 | guysbuf[i] = tempguy; | |
| 15282 | 39424 | } | |
| 15283 | 39424 | } | |
| 15284 | 77 | } | |
| 15285 | |||
| 15286 | 77 | return 0; | |
| 15287 | 77 | } | |
| 15288 | |||
| 15289 | ✗ | void update_guy_1(guydata *tempguy) // November 2009 | |
| 15290 | { | ||
| 15291 | ✗ | bool doesntcount = false; | |
| 15292 | ✗ | tempguy->flags &= ~weak_arrow; // Formerly 'weak to arrow' which wasn't implemented | |
| 15293 | |||
| 15294 | ✗ | switch(tempguy->family) | |
| 15295 | { | ||
| 15296 | case 1: //eeWALK | ||
| 15297 | ✗ | switch(tempguy->misc10) | |
| 15298 | { | ||
| 15299 | case 0: //Stalfos | ||
| 15300 | ✗ | if(tempguy->misc1==1) // Fires four projectiles at once | |
| 15301 | ✗ | tempguy->misc1=4; | |
| 15302 | |||
| 15303 | ✗ | break; | |
| 15304 | |||
| 15305 | case 1: //Darknut | ||
| 15306 | ✗ | goto darknuts; | |
| 15307 | break; | ||
| 15308 | } | ||
| 15309 | |||
| 15310 | ✗ | tempguy->misc10 = 0; | |
| 15311 | ✗ | break; | |
| 15312 | |||
| 15313 | case 2: //eeSHOOT | ||
| 15314 | ✗ | tempguy->family = eeWALK; | |
| 15315 | |||
| 15316 | ✗ | switch(tempguy->misc10) | |
| 15317 | { | ||
| 15318 | case 0: //Octorok | ||
| 15319 | ✗ | if(tempguy->misc1==1||tempguy->misc1==2) | |
| 15320 | { | ||
| 15321 | ✗ | tempguy->misc1=e1tFIREOCTO; | |
| 15322 | ✗ | tempguy->misc2=e2tFIREOCTO; | |
| 15323 | } | ||
| 15324 | ✗ | else tempguy->misc1 = 0; | |
| 15325 | |||
| 15326 | ✗ | tempguy->misc6=tempguy->misc4; | |
| 15327 | ✗ | tempguy->misc4=tempguy->misc3; | |
| 15328 | ✗ | tempguy->misc3=0; | |
| 15329 | ✗ | break; | |
| 15330 | |||
| 15331 | case 1: // Moblin | ||
| 15332 | ✗ | tempguy->misc1 = 0; | |
| 15333 | ✗ | break; | |
| 15334 | |||
| 15335 | case 2: //Lynel | ||
| 15336 | ✗ | tempguy->misc6=tempguy->misc1+1; | |
| 15337 | ✗ | tempguy->misc1=0; | |
| 15338 | ✗ | break; | |
| 15339 | |||
| 15340 | case 3: //Stalfos 2 | ||
| 15341 | ✗ | if(tempguy->misc1==1) // Fires four projectiles at once | |
| 15342 | ✗ | tempguy->misc1=e1t4SHOTS; | |
| 15343 | ✗ | else tempguy->misc1 = 0; | |
| 15344 | |||
| 15345 | ✗ | break; | |
| 15346 | |||
| 15347 | case 4: //Darknut 5 | ||
| 15348 | darknuts: | ||
| 15349 | ✗ | tempguy->defense[edefFIRE] = edIGNORE; | |
| 15350 | ✗ | tempguy->defense[edefBRANG] = edSTUNORCHINK; | |
| 15351 | ✗ | tempguy->defense[edefHOOKSHOT] = 0; | |
| 15352 | ✗ | tempguy->defense[edefARROW] = tempguy->defense[edefBYRNA] = tempguy->defense[edefREFROCK] = | |
| 15353 | ✗ | tempguy->defense[edefMAGIC] = tempguy->defense[edefSTOMP] = edCHINK; | |
| 15354 | |||
| 15355 | ✗ | if(tempguy->misc1==1) | |
| 15356 | ✗ | tempguy->misc1=2; | |
| 15357 | ✗ | else if(tempguy->misc1==2) | |
| 15358 | { | ||
| 15359 | ✗ | tempguy->misc4=tempguy->misc3; | |
| 15360 | ✗ | tempguy->misc3=tempguy->misc2; | |
| 15361 | ✗ | tempguy->misc2=e2tSPLIT; | |
| 15362 | ✗ | tempguy->misc1 = 0; | |
| 15363 | } | ||
| 15364 | ✗ | else tempguy->misc1 = 0; | |
| 15365 | |||
| 15366 | ✗ | tempguy->flags |= inv_front; | |
| 15367 | |||
| 15368 | ✗ | if(get_bit(deprecated_rules,qr_BRKBLSHLDS_DEP)) | |
| 15369 | ✗ | tempguy->flags |= guy_bkshield; | |
| 15370 | |||
| 15371 | ✗ | break; | |
| 15372 | } | ||
| 15373 | |||
| 15374 | ✗ | tempguy->misc10 = 0; | |
| 15375 | ✗ | break; | |
| 15376 | |||
| 15377 | /* | ||
| 15378 | case 9: //eeARMOS | ||
| 15379 | tempguy->family = eeWALK; | ||
| 15380 | break; | ||
| 15381 | */ | ||
| 15382 | case 11: //eeGEL | ||
| 15383 | case 33: //eeGELTRIB | ||
| 15384 | ✗ | if(tempguy->family==33) | |
| 15385 | { | ||
| 15386 | ✗ | tempguy->misc4 = 1; | |
| 15387 | |||
| 15388 | ✗ | if(get_bit(deprecated_rules, qr_OLDTRIBBLES_DEP)) //Old Tribbles | |
| 15389 | ✗ | tempguy->misc3 = tempguy->misc2; | |
| 15390 | |||
| 15391 | ✗ | tempguy->misc2 = e2tTRIBBLE; | |
| 15392 | } | ||
| 15393 | else | ||
| 15394 | { | ||
| 15395 | ✗ | tempguy->misc4 = 0; | |
| 15396 | ✗ | tempguy->misc3 = 0; | |
| 15397 | ✗ | tempguy->misc2 = 0; | |
| 15398 | } | ||
| 15399 | |||
| 15400 | ✗ | tempguy->family = eeWALK; | |
| 15401 | |||
| 15402 | ✗ | if(tempguy->misc1) | |
| 15403 | { | ||
| 15404 | ✗ | tempguy->misc1=1; | |
| 15405 | ✗ | tempguy->weapon = ewFireTrail; | |
| 15406 | } | ||
| 15407 | |||
| 15408 | ✗ | break; | |
| 15409 | |||
| 15410 | case 34: //eeZOLTRIB | ||
| 15411 | case 12: //eeZOL | ||
| 15412 | ✗ | tempguy->misc4=tempguy->misc3; | |
| 15413 | ✗ | tempguy->misc3=tempguy->misc2; | |
| 15414 | ✗ | tempguy->family = eeWALK; | |
| 15415 | ✗ | tempguy->misc2=e2tSPLITHIT; | |
| 15416 | |||
| 15417 | ✗ | if(tempguy->misc1) | |
| 15418 | { | ||
| 15419 | ✗ | tempguy->misc1=1; | |
| 15420 | ✗ | tempguy->weapon = ewFireTrail; | |
| 15421 | } | ||
| 15422 | |||
| 15423 | ✗ | break; | |
| 15424 | |||
| 15425 | case 13: //eeROPE | ||
| 15426 | ✗ | tempguy->family = eeWALK; | |
| 15427 | ✗ | tempguy->misc9 = e9tROPE; | |
| 15428 | |||
| 15429 | ✗ | if(tempguy->misc1) | |
| 15430 | { | ||
| 15431 | ✗ | tempguy->misc4 = tempguy->misc3; | |
| 15432 | ✗ | tempguy->misc3 = tempguy->misc2; | |
| 15433 | ✗ | tempguy->misc2 = e2tBOMBCHU; | |
| 15434 | } | ||
| 15435 | |||
| 15436 | ✗ | tempguy->misc1 = 0; | |
| 15437 | ✗ | break; | |
| 15438 | |||
| 15439 | case 14: //eeGORIYA | ||
| 15440 | ✗ | tempguy->family = eeWALK; | |
| 15441 | |||
| 15442 | ✗ | if(tempguy->misc1!=2) tempguy->misc1 = 0; | |
| 15443 | |||
| 15444 | ✗ | break; | |
| 15445 | |||
| 15446 | case 17: //eeBUBBLE | ||
| 15447 | ✗ | tempguy->family = eeWALK; | |
| 15448 | ✗ | tempguy->misc8 = tempguy->misc2; | |
| 15449 | ✗ | tempguy->misc7 = tempguy->misc1 + 1; | |
| 15450 | ✗ | tempguy->misc1 = tempguy->misc2 = 0; | |
| 15451 | |||
| 15452 | //fallthrogh | ||
| 15453 | case eeTRAP: | ||
| 15454 | case eeROCK: | ||
| 15455 | ✗ | doesntcount = true; | |
| 15456 | ✗ | break; | |
| 15457 | |||
| 15458 | case 35: //eeVIRETRIB | ||
| 15459 | case 18: //eeVIRE | ||
| 15460 | ✗ | tempguy->family = eeWALK; | |
| 15461 | ✗ | tempguy->misc4=tempguy->misc3; | |
| 15462 | ✗ | tempguy->misc3=tempguy->misc2; | |
| 15463 | ✗ | tempguy->misc2=e2tSPLITHIT; | |
| 15464 | ✗ | tempguy->misc9=e9tVIRE; | |
| 15465 | ✗ | break; | |
| 15466 | |||
| 15467 | case 19: //eeLIKE | ||
| 15468 | ✗ | tempguy->family = eeWALK; | |
| 15469 | ✗ | tempguy->misc7 = e7tEATITEMS; | |
| 15470 | ✗ | tempguy->misc8=95; | |
| 15471 | ✗ | break; | |
| 15472 | |||
| 15473 | case 20: //eePOLSV | ||
| 15474 | ✗ | tempguy->defense[edefBRANG] = edSTUNORCHINK; | |
| 15475 | ✗ | tempguy->defense[edefBOMB] = tempguy->defense[edefSBOMB] = tempguy->defense[edefFIRE] = edIGNORE; | |
| 15476 | ✗ | tempguy->defense[edefMAGIC] = tempguy->defense[edefBYRNA] = edCHINK; | |
| 15477 | ✗ | tempguy->defense[edefARROW] = ed1HKO; | |
| 15478 | ✗ | tempguy->defense[edefHOOKSHOT] = edSTUNONLY; | |
| 15479 | ✗ | tempguy->family = eeWALK; | |
| 15480 | ✗ | tempguy->misc9 = e9tPOLSVOICE; | |
| 15481 | ✗ | tempguy->rate = 4; | |
| 15482 | ✗ | tempguy->homing = 32; | |
| 15483 | ✗ | tempguy->hrate = 10; | |
| 15484 | ✗ | tempguy->grumble = 0; | |
| 15485 | ✗ | break; | |
| 15486 | |||
| 15487 | case eeWIZZ: | ||
| 15488 | ✗ | if(tempguy->misc4) | |
| 15489 | { | ||
| 15490 | ✗ | for(int32_t i=0; i < edefLAST; i++) | |
| 15491 | ✗ | tempguy->defense[i] = (i != edefREFBEAM && i != edefREFMAGIC && i != edefQUAKE) ? edIGNORE : 0; | |
| 15492 | } | ||
| 15493 | else | ||
| 15494 | { | ||
| 15495 | ✗ | tempguy->defense[edefBRANG] = edSTUNORCHINK; | |
| 15496 | ✗ | tempguy->defense[edefMAGIC] = edCHINK; | |
| 15497 | ✗ | tempguy->defense[edefHOOKSHOT] = edSTUNONLY; | |
| 15498 | ✗ | tempguy->defense[edefARROW] = tempguy->defense[edefFIRE] = | |
| 15499 | ✗ | tempguy->defense[edefWAND] = tempguy->defense[edefBYRNA] = edIGNORE; | |
| 15500 | } | ||
| 15501 | |||
| 15502 | ✗ | break; | |
| 15503 | |||
| 15504 | case eePEAHAT: | ||
| 15505 | ✗ | tempguy->flags &= ~(guy_superman|guy_sbombonly); | |
| 15506 | |||
| 15507 | ✗ | if(!(tempguy->flags & guy_bhit)) | |
| 15508 | ✗ | tempguy->defense[edefBRANG] = edSTUNONLY; | |
| 15509 | |||
| 15510 | ✗ | break; | |
| 15511 | |||
| 15512 | case eeLEV: | ||
| 15513 | ✗ | tempguy->defense[edefSTOMP] = edCHINK; | |
| 15514 | ✗ | break; | |
| 15515 | } | ||
| 15516 | |||
| 15517 | // Old flags | ||
| 15518 | ✗ | if(tempguy->flags & guy_superman) | |
| 15519 | { | ||
| 15520 | ✗ | for(int32_t i = 0; i < edefLAST; i++) | |
| 15521 | ✗ | if(!(i==edefSBOMB && (tempguy->flags & guy_sbombonly))) | |
| 15522 | ✗ | tempguy->defense[i] = (i==edefBRANG && tempguy->defense[i] != edIGNORE | |
| 15523 | ✗ | && tempguy->family != eeROCK && tempguy->family != eeTRAP | |
| 15524 | ✗ | && tempguy->family != eePROJECTILE) ? edSTUNORIGNORE : edIGNORE; | |
| 15525 | } | ||
| 15526 | |||
| 15527 | ✗ | tempguy->flags &= ~(guy_superman|guy_sbombonly); | |
| 15528 | |||
| 15529 | ✗ | if(doesntcount) | |
| 15530 | ✗ | tempguy->flags |= (guy_doesntcount); | |
| 15531 | } | ||
| 15532 | |||
| 15533 | |||
| 15534 | 118048 | int32_t readmapscreen_old(PACKFILE *f, zquestheader *Header, mapscr *temp_mapscr, zcmap *temp_map, word version) | |
| 15535 | { | ||
| 15536 | byte tempbyte, padding; | ||
| 15537 | int32_t extras, secretcombos; | ||
| 15538 | //al_trace("readmapscreen Header->zelda_version: %x\n",Header->zelda_version); | ||
| 15539 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->valid),f,true)) |
| 15540 | { | ||
| 15541 | ✗ | return qe_invalid; | |
| 15542 | } | ||
| 15543 | |||
| 15544 | |||
| 15545 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->guy),f,true)) |
| 15546 | { | ||
| 15547 | ✗ | return qe_invalid; | |
| 15548 | } | ||
| 15549 | |||
| 15550 |
2/6✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 118048 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<146))) |
| 15551 | { | ||
| 15552 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 15553 | { | ||
| 15554 | ✗ | return qe_invalid; | |
| 15555 | } | ||
| 15556 | |||
| 15557 | ✗ | temp_mapscr->str=tempbyte; | |
| 15558 | } | ||
| 15559 | else | ||
| 15560 | { | ||
| 15561 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_igetw(&(temp_mapscr->str),f,true)) |
| 15562 | { | ||
| 15563 | ✗ | return qe_invalid; | |
| 15564 | } | ||
| 15565 | } | ||
| 15566 | |||
| 15567 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->room),f,true)) |
| 15568 | { | ||
| 15569 | ✗ | return qe_invalid; | |
| 15570 | } | ||
| 15571 | |||
| 15572 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->item),f,true)) |
| 15573 | { | ||
| 15574 | ✗ | return qe_invalid; | |
| 15575 | } | ||
| 15576 | |||
| 15577 |
2/6✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 118048 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if(Header->zelda_version < 0x211 || (Header->zelda_version == 0x211 && Header->build < 14)) |
| 15578 | { | ||
| 15579 | ✗ | temp_mapscr->hasitem = (temp_mapscr->item != 0) ? 1 : 0; | |
| 15580 | } | ||
| 15581 | else | ||
| 15582 | { | ||
| 15583 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->hasitem),f,true)) |
| 15584 | ✗ | return qe_invalid; | |
| 15585 | } | ||
| 15586 | |||
| 15587 |
1/4✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
118048 | if((Header->zelda_version < 0x192)|| |
| 15588 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | ((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 15589 | { | ||
| 15590 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 15591 | { | ||
| 15592 | ✗ | return qe_invalid; | |
| 15593 | } | ||
| 15594 | } | ||
| 15595 | |||
| 15596 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->tilewarptype[0]),f,true)) |
| 15597 | { | ||
| 15598 | ✗ | return qe_invalid; | |
| 15599 | } | ||
| 15600 | |||
| 15601 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(Header->zelda_version < 0x193) |
| 15602 | { | ||
| 15603 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 15604 | { | ||
| 15605 | ✗ | return qe_invalid; | |
| 15606 | } | ||
| 15607 | } | ||
| 15608 | |||
| 15609 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15610 | { | ||
| 15611 |
2/2✓ Branch 0 taken 354144 times.
✓ Branch 1 taken 118048 times.
|
472192 | for(int32_t i=1; i<4; i++) |
| 15612 | { | ||
| 15613 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 354144 times.
|
354144 | if(!p_getc(&(temp_mapscr->tilewarptype[i]),f,true)) |
| 15614 | { | ||
| 15615 | ✗ | return qe_invalid; | |
| 15616 | } | ||
| 15617 | 354144 | } | |
| 15618 | 118048 | } | |
| 15619 | else | ||
| 15620 | { | ||
| 15621 | ✗ | temp_mapscr->tilewarptype[1]=0; | |
| 15622 | ✗ | temp_mapscr->tilewarptype[2]=0; | |
| 15623 | ✗ | temp_mapscr->tilewarptype[3]=0; | |
| 15624 | } | ||
| 15625 | |||
| 15626 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>153))) |
| 15627 | { | ||
| 15628 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_igetw(&(temp_mapscr->door_combo_set),f,true)) |
| 15629 | { | ||
| 15630 | ✗ | return qe_invalid; | |
| 15631 | } | ||
| 15632 | 118048 | } | |
| 15633 | |||
| 15634 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->warpreturnx[0]),f,true)) |
| 15635 | { | ||
| 15636 | ✗ | return qe_invalid; | |
| 15637 | } | ||
| 15638 | |||
| 15639 | 118048 | temp_mapscr->warpreturnx[1]=0; | |
| 15640 | 118048 | temp_mapscr->warpreturnx[2]=0; | |
| 15641 | 118048 | temp_mapscr->warpreturnx[3]=0; | |
| 15642 | |||
| 15643 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15644 | { | ||
| 15645 |
2/2✓ Branch 0 taken 354144 times.
✓ Branch 1 taken 118048 times.
|
472192 | for(int32_t i=1; i<4; i++) |
| 15646 | { | ||
| 15647 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 354144 times.
|
354144 | if(!p_getc(&(temp_mapscr->warpreturnx[i]),f,true)) |
| 15648 | { | ||
| 15649 | ✗ | return qe_invalid; | |
| 15650 | } | ||
| 15651 | 354144 | } | |
| 15652 | 118048 | } | |
| 15653 | |||
| 15654 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->warpreturny[0]),f,true)) |
| 15655 | { | ||
| 15656 | ✗ | return qe_invalid; | |
| 15657 | } | ||
| 15658 | |||
| 15659 | 118048 | temp_mapscr->warpreturny[1]=0; | |
| 15660 | 118048 | temp_mapscr->warpreturny[2]=0; | |
| 15661 | 118048 | temp_mapscr->warpreturny[3]=0; | |
| 15662 | |||
| 15663 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15664 | { | ||
| 15665 |
2/2✓ Branch 0 taken 354144 times.
✓ Branch 1 taken 118048 times.
|
472192 | for(int32_t i=1; i<4; i++) |
| 15666 | { | ||
| 15667 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 354144 times.
|
354144 | if(!p_getc(&(temp_mapscr->warpreturny[i]),f,true)) |
| 15668 | { | ||
| 15669 | ✗ | return qe_invalid; | |
| 15670 | } | ||
| 15671 | 354144 | } | |
| 15672 | |||
| 15673 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(version>=18) |
| 15674 | { | ||
| 15675 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_igetw(&temp_mapscr->warpreturnc,f,true)) |
| 15676 | { | ||
| 15677 | ✗ | return qe_invalid; | |
| 15678 | } | ||
| 15679 | 118048 | } | |
| 15680 | else | ||
| 15681 | { | ||
| 15682 | byte temp; | ||
| 15683 | |||
| 15684 | ✗ | if(!p_getc(&temp,f,true)) | |
| 15685 | { | ||
| 15686 | ✗ | return qe_invalid; | |
| 15687 | } | ||
| 15688 | |||
| 15689 | ✗ | temp_mapscr->warpreturnc=temp<<8|temp; | |
| 15690 | } | ||
| 15691 | 118048 | } | |
| 15692 | |||
| 15693 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->stairx),f,true)) |
| 15694 | |||
| 15695 | { | ||
| 15696 | ✗ | return qe_invalid; | |
| 15697 | } | ||
| 15698 | |||
| 15699 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->stairy),f,true)) |
| 15700 | { | ||
| 15701 | ✗ | return qe_invalid; | |
| 15702 | } | ||
| 15703 | |||
| 15704 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->itemx),f,true)) |
| 15705 | { | ||
| 15706 | ✗ | return qe_invalid; | |
| 15707 | } | ||
| 15708 | |||
| 15709 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->itemy),f,true)) |
| 15710 | { | ||
| 15711 | ✗ | return qe_invalid; | |
| 15712 | } | ||
| 15713 | |||
| 15714 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(version > 15) // February 2009 |
| 15715 | { | ||
| 15716 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_igetw(&(temp_mapscr->color),f,true)) |
| 15717 | { | ||
| 15718 | ✗ | return qe_invalid; | |
| 15719 | } | ||
| 15720 | 118048 | } | |
| 15721 | else | ||
| 15722 | { | ||
| 15723 | ✗ | if(!p_getc(& tempbyte,f,true)) | |
| 15724 | { | ||
| 15725 | ✗ | return qe_invalid; | |
| 15726 | } | ||
| 15727 | |||
| 15728 | ✗ | temp_mapscr->color = (word) tempbyte; | |
| 15729 | } | ||
| 15730 | |||
| 15731 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->enemyflags),f,true)) |
| 15732 | { | ||
| 15733 | ✗ | return qe_invalid; | |
| 15734 | } | ||
| 15735 | |||
| 15736 |
2/2✓ Branch 0 taken 472192 times.
✓ Branch 1 taken 118048 times.
|
590240 | for(int32_t k=0; k<4; k++) |
| 15737 | { | ||
| 15738 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 472192 times.
|
472192 | if(!p_getc(&(temp_mapscr->door[k]),f,true)) |
| 15739 | { | ||
| 15740 | ✗ | return qe_invalid; | |
| 15741 | |||
| 15742 | } | ||
| 15743 | 472192 | } | |
| 15744 | |||
| 15745 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(version <= 11) |
| 15746 | { | ||
| 15747 | ✗ | if(!p_getc(&(tempbyte),f,true)) | |
| 15748 | { | ||
| 15749 | ✗ | return qe_invalid; | |
| 15750 | } | ||
| 15751 | |||
| 15752 | ✗ | temp_mapscr->tilewarpdmap[0]=(word)tempbyte; | |
| 15753 | |||
| 15754 | ✗ | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) | |
| 15755 | { | ||
| 15756 | ✗ | for(int32_t i=1; i<4; i++) | |
| 15757 | { | ||
| 15758 | ✗ | if(!p_getc(&(tempbyte),f,true)) | |
| 15759 | { | ||
| 15760 | ✗ | return qe_invalid; | |
| 15761 | } | ||
| 15762 | |||
| 15763 | ✗ | temp_mapscr->tilewarpdmap[i]=(word)tempbyte; | |
| 15764 | } | ||
| 15765 | } | ||
| 15766 | else | ||
| 15767 | { | ||
| 15768 | ✗ | temp_mapscr->tilewarpdmap[1]=0; | |
| 15769 | ✗ | temp_mapscr->tilewarpdmap[2]=0; | |
| 15770 | ✗ | temp_mapscr->tilewarpdmap[3]=0; | |
| 15771 | } | ||
| 15772 | } | ||
| 15773 | else | ||
| 15774 | { | ||
| 15775 |
2/2✓ Branch 0 taken 472192 times.
✓ Branch 1 taken 118048 times.
|
590240 | for(int32_t i=0; i<4; i++) |
| 15776 | { | ||
| 15777 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 472192 times.
|
472192 | if(!p_igetw(&(temp_mapscr->tilewarpdmap[i]),f,true)) |
| 15778 | { | ||
| 15779 | ✗ | return qe_invalid; | |
| 15780 | } | ||
| 15781 | 472192 | } | |
| 15782 | } | ||
| 15783 | |||
| 15784 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->tilewarpscr[0]),f,true)) |
| 15785 | { | ||
| 15786 | ✗ | return qe_invalid; | |
| 15787 | } | ||
| 15788 | |||
| 15789 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15790 | { | ||
| 15791 |
2/2✓ Branch 0 taken 354144 times.
✓ Branch 1 taken 118048 times.
|
472192 | for(int32_t i=1; i<4; i++) |
| 15792 | { | ||
| 15793 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 354144 times.
|
354144 | if(!p_getc(&(temp_mapscr->tilewarpscr[i]),f,true)) |
| 15794 | { | ||
| 15795 | ✗ | return qe_invalid; | |
| 15796 | } | ||
| 15797 | 354144 | } | |
| 15798 | 118048 | } | |
| 15799 | else | ||
| 15800 | { | ||
| 15801 | ✗ | temp_mapscr->tilewarpscr[1]=0; | |
| 15802 | ✗ | temp_mapscr->tilewarpscr[2]=0; | |
| 15803 | ✗ | temp_mapscr->tilewarpscr[3]=0; | |
| 15804 | } | ||
| 15805 | |||
| 15806 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(version >= 15) |
| 15807 | { | ||
| 15808 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->tilewarpoverlayflags),f,true)) |
| 15809 | { | ||
| 15810 | ✗ | return qe_invalid; | |
| 15811 | } | ||
| 15812 | 118048 | } | |
| 15813 | else | ||
| 15814 | { | ||
| 15815 | ✗ | temp_mapscr->tilewarpoverlayflags=0; | |
| 15816 | } | ||
| 15817 | |||
| 15818 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->exitdir),f,true)) |
| 15819 | { | ||
| 15820 | ✗ | return qe_invalid; | |
| 15821 | } | ||
| 15822 | |||
| 15823 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(Header->zelda_version < 0x193) |
| 15824 | { | ||
| 15825 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 15826 | { | ||
| 15827 | ✗ | return qe_invalid; | |
| 15828 | } | ||
| 15829 | |||
| 15830 | } | ||
| 15831 | |||
| 15832 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version == 0x192)&&(Header->build>145)&&(Header->build<154)) |
| 15833 | { | ||
| 15834 | ✗ | if(!p_getc(&padding,f,true)) | |
| 15835 | { | ||
| 15836 | ✗ | return qe_invalid; | |
| 15837 | } | ||
| 15838 | } | ||
| 15839 | |||
| 15840 |
2/2✓ Branch 0 taken 1180480 times.
✓ Branch 1 taken 118048 times.
|
1298528 | for(int32_t k=0; k<10; k++) |
| 15841 | { | ||
| 15842 | /* | ||
| 15843 | if (!temp_mapscr->enemy[k]) | ||
| 15844 | { | ||
| 15845 | continue; | ||
| 15846 | } | ||
| 15847 | */ | ||
| 15848 |
2/6✓ Branch 0 taken 1180480 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1180480 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1180480 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<10))) |
| 15849 | { | ||
| 15850 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 15851 | { | ||
| 15852 | ✗ | return qe_invalid; | |
| 15853 | } | ||
| 15854 | |||
| 15855 | ✗ | temp_mapscr->enemy[k]=tempbyte; | |
| 15856 | } | ||
| 15857 | else | ||
| 15858 | { | ||
| 15859 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1180480 times.
|
1180480 | if(!p_igetw(&(temp_mapscr->enemy[k]),f,true)) |
| 15860 | { | ||
| 15861 | ✗ | return qe_invalid; | |
| 15862 | } | ||
| 15863 | } | ||
| 15864 | |||
| 15865 |
2/6✓ Branch 0 taken 1180480 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1180480 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1180480 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<108))) |
| 15866 | { | ||
| 15867 | //using enumerations here is dangerous | ||
| 15868 | //very easy to break old quests -DD | ||
| 15869 | ✗ | if(temp_mapscr->enemy[k]>=57) //old eGOHMA1 | |
| 15870 | { | ||
| 15871 | ✗ | temp_mapscr->enemy[k]+=5; | |
| 15872 | } | ||
| 15873 | ✗ | else if(temp_mapscr->enemy[k]>=52) //old eGLEEOK2 | |
| 15874 | { | ||
| 15875 | ✗ | temp_mapscr->enemy[k]+=1; | |
| 15876 | } | ||
| 15877 | } | ||
| 15878 | |||
| 15879 |
1/2✓ Branch 0 taken 1180480 times.
✗ Branch 1 not taken.
|
1180480 | if(version < 9) |
| 15880 | { | ||
| 15881 | ✗ | if(temp_mapscr->enemy[k]>0) | |
| 15882 | { | ||
| 15883 | ✗ | temp_mapscr->enemy[k]+=10; | |
| 15884 | } | ||
| 15885 | } | ||
| 15886 | //don't read in any invalid data | ||
| 15887 |
1/2✓ Branch 0 taken 1180480 times.
✗ Branch 1 not taken.
|
1180480 | if ( ((unsigned)temp_mapscr->enemy[k]) > MAXGUYS ) |
| 15888 | { | ||
| 15889 | ✗ | al_trace("Tried to read an invalid enemy ID (%d) for tmpscr->enemy[%d]. This has been cleared to 0.\n", temp_mapscr->enemy[k], k); | |
| 15890 | ✗ | temp_mapscr->enemy[k] = 0; | |
| 15891 | } | ||
| 15892 | 1180480 | } | |
| 15893 | |||
| 15894 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->pattern),f,true)) |
| 15895 | { | ||
| 15896 | ✗ | return qe_invalid; | |
| 15897 | } | ||
| 15898 | |||
| 15899 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->sidewarptype[0]),f,true)) |
| 15900 | { | ||
| 15901 | ✗ | return qe_invalid; | |
| 15902 | } | ||
| 15903 | |||
| 15904 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15905 | { | ||
| 15906 |
2/2✓ Branch 0 taken 354144 times.
✓ Branch 1 taken 118048 times.
|
472192 | for(int32_t i=1; i<4; i++) |
| 15907 | { | ||
| 15908 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 354144 times.
|
354144 | if(!p_getc(&(temp_mapscr->sidewarptype[i]),f,true)) |
| 15909 | { | ||
| 15910 | ✗ | return qe_invalid; | |
| 15911 | } | ||
| 15912 | 354144 | } | |
| 15913 | 118048 | } | |
| 15914 | else | ||
| 15915 | { | ||
| 15916 | ✗ | temp_mapscr->sidewarptype[1]=0; | |
| 15917 | ✗ | temp_mapscr->sidewarptype[2]=0; | |
| 15918 | ✗ | temp_mapscr->sidewarptype[3]=0; | |
| 15919 | } | ||
| 15920 | |||
| 15921 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(version >= 15) |
| 15922 | { | ||
| 15923 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->sidewarpoverlayflags),f,true)) |
| 15924 | { | ||
| 15925 | ✗ | return qe_invalid; | |
| 15926 | } | ||
| 15927 | 118048 | } | |
| 15928 | else | ||
| 15929 | { | ||
| 15930 | ✗ | temp_mapscr->sidewarpoverlayflags=0; | |
| 15931 | } | ||
| 15932 | |||
| 15933 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->warparrivalx),f,true)) |
| 15934 | { | ||
| 15935 | ✗ | return qe_invalid; | |
| 15936 | } | ||
| 15937 | |||
| 15938 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->warparrivaly),f,true)) |
| 15939 | { | ||
| 15940 | ✗ | return qe_invalid; | |
| 15941 | } | ||
| 15942 | |||
| 15943 |
2/2✓ Branch 0 taken 472192 times.
✓ Branch 1 taken 118048 times.
|
590240 | for(int32_t k=0; k<4; k++) |
| 15944 | { | ||
| 15945 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 472192 times.
|
472192 | if(!p_getc(&(temp_mapscr->path[k]),f,true)) |
| 15946 | { | ||
| 15947 | ✗ | return qe_invalid; | |
| 15948 | } | ||
| 15949 | 472192 | } | |
| 15950 | |||
| 15951 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->sidewarpscr[0]),f,true)) |
| 15952 | { | ||
| 15953 | ✗ | return qe_invalid; | |
| 15954 | } | ||
| 15955 | |||
| 15956 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15957 | { | ||
| 15958 |
2/2✓ Branch 0 taken 118048 times.
✓ Branch 1 taken 354144 times.
|
472192 | for(int32_t i=1; i<4; i++) |
| 15959 | { | ||
| 15960 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 354144 times.
|
354144 | if(!p_getc(&(temp_mapscr->sidewarpscr[i]),f,true)) |
| 15961 | { | ||
| 15962 | ✗ | return qe_invalid; | |
| 15963 | } | ||
| 15964 | 354144 | } | |
| 15965 | 118048 | } | |
| 15966 | else | ||
| 15967 | { | ||
| 15968 | ✗ | temp_mapscr->sidewarpscr[1]=0; | |
| 15969 | ✗ | temp_mapscr->sidewarpscr[2]=0; | |
| 15970 | ✗ | temp_mapscr->sidewarpscr[3]=0; | |
| 15971 | } | ||
| 15972 | |||
| 15973 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(version <= 11) |
| 15974 | { | ||
| 15975 | ✗ | if(!p_getc(&(tempbyte),f,true)) | |
| 15976 | { | ||
| 15977 | ✗ | return qe_invalid; | |
| 15978 | } | ||
| 15979 | |||
| 15980 | ✗ | temp_mapscr->sidewarpdmap[0]=(word)tempbyte; | |
| 15981 | |||
| 15982 | ✗ | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) | |
| 15983 | { | ||
| 15984 | ✗ | for(int32_t i=1; i<4; i++) | |
| 15985 | { | ||
| 15986 | ✗ | if(!p_getc(&(tempbyte),f,true)) | |
| 15987 | { | ||
| 15988 | ✗ | return qe_invalid; | |
| 15989 | } | ||
| 15990 | |||
| 15991 | ✗ | temp_mapscr->sidewarpdmap[i]=(word)tempbyte; | |
| 15992 | } | ||
| 15993 | } | ||
| 15994 | else | ||
| 15995 | { | ||
| 15996 | ✗ | temp_mapscr->sidewarpdmap[1]=0; | |
| 15997 | ✗ | temp_mapscr->sidewarpdmap[2]=0; | |
| 15998 | ✗ | temp_mapscr->sidewarpdmap[3]=0; | |
| 15999 | } | ||
| 16000 | } | ||
| 16001 | else | ||
| 16002 | { | ||
| 16003 |
2/2✓ Branch 0 taken 472192 times.
✓ Branch 1 taken 118048 times.
|
590240 | for(int32_t i=0; i<4; i++) |
| 16004 | { | ||
| 16005 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 472192 times.
|
472192 | if(!p_igetw(&(temp_mapscr->sidewarpdmap[i]),f,true)) |
| 16006 | { | ||
| 16007 | ✗ | return qe_invalid; | |
| 16008 | } | ||
| 16009 | 472192 | } | |
| 16010 | } | ||
| 16011 | |||
| 16012 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 16013 | { | ||
| 16014 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->sidewarpindex),f,true)) |
| 16015 | { | ||
| 16016 | ✗ | return qe_invalid; | |
| 16017 | } | ||
| 16018 | 118048 | } | |
| 16019 | ✗ | else temp_mapscr->sidewarpindex = 0; | |
| 16020 | |||
| 16021 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_igetw(&(temp_mapscr->undercombo),f,true)) |
| 16022 | { | ||
| 16023 | ✗ | return qe_invalid; | |
| 16024 | } | ||
| 16025 | |||
| 16026 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(Header->zelda_version < 0x193) |
| 16027 | { | ||
| 16028 | ✗ | if(!p_getc(&(temp_mapscr->old_cpage),f,true)) | |
| 16029 | { | ||
| 16030 | ✗ | return qe_invalid; | |
| 16031 | } | ||
| 16032 | } | ||
| 16033 | |||
| 16034 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->undercset),f,true)) //recalculated for older quests |
| 16035 | { | ||
| 16036 | ✗ | return qe_invalid; | |
| 16037 | } | ||
| 16038 | |||
| 16039 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_igetw(&(temp_mapscr->catchall),f,true)) |
| 16040 | { | ||
| 16041 | ✗ | return qe_invalid; | |
| 16042 | } | ||
| 16043 | |||
| 16044 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->flags),f,true)) |
| 16045 | { | ||
| 16046 | ✗ | return qe_invalid; | |
| 16047 | } | ||
| 16048 | |||
| 16049 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->flags2),f,true)) |
| 16050 | { | ||
| 16051 | ✗ | return qe_invalid; | |
| 16052 | } | ||
| 16053 | |||
| 16054 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->flags3),f,true)) |
| 16055 | { | ||
| 16056 | ✗ | return qe_invalid; | |
| 16057 | } | ||
| 16058 | |||
| 16059 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>1))) |
| 16060 | //if (version>2) | ||
| 16061 | { | ||
| 16062 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->flags4),f,true)) |
| 16063 | { | ||
| 16064 | ✗ | return qe_invalid; | |
| 16065 | } | ||
| 16066 | 118048 | } | |
| 16067 | |||
| 16068 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 16069 | { | ||
| 16070 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->flags5),f,true)) |
| 16071 | { | ||
| 16072 | ✗ | return qe_invalid; | |
| 16073 | } | ||
| 16074 | |||
| 16075 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_igetw(&(temp_mapscr->noreset),f,true)) |
| 16076 | { | ||
| 16077 | ✗ | return qe_invalid; | |
| 16078 | } | ||
| 16079 | |||
| 16080 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_igetw(&(temp_mapscr->nocarry),f,true)) |
| 16081 | { | ||
| 16082 | ✗ | return qe_invalid; | |
| 16083 | } | ||
| 16084 | |||
| 16085 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(temp_mapscr->flags5&32) |
| 16086 | { | ||
| 16087 | ✗ | temp_mapscr->flags5 &= ~32; | |
| 16088 | ✗ | temp_mapscr->noreset |= 48; | |
| 16089 | } | ||
| 16090 | |||
| 16091 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(version<8) |
| 16092 | { | ||
| 16093 | ✗ | if(temp_mapscr->noreset&1) | |
| 16094 | { | ||
| 16095 | ✗ | temp_mapscr->noreset|=8192; | |
| 16096 | } | ||
| 16097 | |||
| 16098 | ✗ | if(temp_mapscr->nocarry&1) | |
| 16099 | { | ||
| 16100 | ✗ | temp_mapscr->nocarry|=8192; | |
| 16101 | ✗ | temp_mapscr->nocarry&=~1; | |
| 16102 | } | ||
| 16103 | } | ||
| 16104 | 118048 | } | |
| 16105 | else | ||
| 16106 | { | ||
| 16107 | ✗ | temp_mapscr->flags5 = 0; | |
| 16108 | ✗ | temp_mapscr->noreset = 0; | |
| 16109 | ✗ | temp_mapscr->nocarry = 0; | |
| 16110 | } | ||
| 16111 | |||
| 16112 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>9))) |
| 16113 | { | ||
| 16114 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->flags6),f,true)) |
| 16115 | { | ||
| 16116 | ✗ | return qe_invalid; | |
| 16117 | } | ||
| 16118 | 118048 | } | |
| 16119 | |||
| 16120 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(version>5) |
| 16121 | { | ||
| 16122 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->flags7),f,true)) |
| 16123 | { | ||
| 16124 | ✗ | return qe_invalid; | |
| 16125 | } | ||
| 16126 | |||
| 16127 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->flags8),f,true)) |
| 16128 | { | ||
| 16129 | ✗ | return qe_invalid; | |
| 16130 | } | ||
| 16131 | |||
| 16132 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->flags9),f,true)) |
| 16133 | { | ||
| 16134 | ✗ | return qe_invalid; | |
| 16135 | } | ||
| 16136 | |||
| 16137 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->flags10),f,true)) |
| 16138 | { | ||
| 16139 | ✗ | return qe_invalid; | |
| 16140 | } | ||
| 16141 | |||
| 16142 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->csensitive),f,true)) |
| 16143 | { | ||
| 16144 | ✗ | return qe_invalid; | |
| 16145 | } | ||
| 16146 | 118048 | } | |
| 16147 | else | ||
| 16148 | { | ||
| 16149 | ✗ | temp_mapscr->csensitive=1; | |
| 16150 | } | ||
| 16151 | |||
| 16152 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(version<14) // August 2007: screen SFX added |
| 16153 | { | ||
| 16154 | ✗ | if(temp_mapscr->flags&8) //fROAR | |
| 16155 | { | ||
| 16156 | ✗ | temp_mapscr->bosssfx= | |
| 16157 | ✗ | (temp_mapscr->flags3&2) ? WAV_DODONGO : // fDODONGO | |
| 16158 | ✗ | (temp_mapscr->flags2&32) ? WAV_VADER : // fVADER | |
| 16159 | WAV_ROAR; | ||
| 16160 | } | ||
| 16161 | |||
| 16162 | ✗ | if(temp_mapscr->flags&128) //fSEA | |
| 16163 | { | ||
| 16164 | ✗ | temp_mapscr->oceansfx=WAV_SEA; | |
| 16165 | } | ||
| 16166 | |||
| 16167 | ✗ | if(!(temp_mapscr->flags3&64)) //fNOSECRETSOUND | |
| 16168 | { | ||
| 16169 | ✗ | temp_mapscr->secretsfx=WAV_SECRET; | |
| 16170 | } | ||
| 16171 | |||
| 16172 | ✗ | temp_mapscr->flags3 &= ~66; //64|2 | |
| 16173 | ✗ | temp_mapscr->flags2 &= ~32; | |
| 16174 | ✗ | temp_mapscr->flags &= ~136; // 128|8 | |
| 16175 | } | ||
| 16176 | else | ||
| 16177 | { | ||
| 16178 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->oceansfx),f,true)) |
| 16179 | { | ||
| 16180 | ✗ | return qe_invalid; | |
| 16181 | } | ||
| 16182 | |||
| 16183 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->bosssfx),f,true)) |
| 16184 | { | ||
| 16185 | ✗ | return qe_invalid; | |
| 16186 | } | ||
| 16187 | |||
| 16188 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->secretsfx),f,true)) |
| 16189 | { | ||
| 16190 | ✗ | return qe_invalid; | |
| 16191 | } | ||
| 16192 | } | ||
| 16193 | |||
| 16194 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(version<15) // October 2007: another SFX |
| 16195 | { | ||
| 16196 | ✗ | temp_mapscr->holdupsfx=WAV_PICKUP; | |
| 16197 | } | ||
| 16198 | else | ||
| 16199 | { | ||
| 16200 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->holdupsfx),f,true)) |
| 16201 | { | ||
| 16202 | ✗ | return qe_invalid; | |
| 16203 | } | ||
| 16204 | } | ||
| 16205 | |||
| 16206 | |||
| 16207 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>97))) |
| 16208 | { | ||
| 16209 |
2/2✓ Branch 0 taken 708288 times.
✓ Branch 1 taken 118048 times.
|
826336 | for(int32_t k=0; k<6; k++) |
| 16210 | { | ||
| 16211 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 708288 times.
|
708288 | if(!p_getc(&(temp_mapscr->layermap[k]),f,true)) |
| 16212 | { | ||
| 16213 | ✗ | return qe_invalid; | |
| 16214 | } | ||
| 16215 | 708288 | } | |
| 16216 | |||
| 16217 |
2/2✓ Branch 0 taken 118048 times.
✓ Branch 1 taken 708288 times.
|
826336 | for(int32_t k=0; k<6; k++) |
| 16218 | { | ||
| 16219 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 708288 times.
|
708288 | if(!p_getc(&(temp_mapscr->layerscreen[k]),f,true)) |
| 16220 | { | ||
| 16221 | ✗ | return qe_invalid; | |
| 16222 | } | ||
| 16223 | 708288 | } | |
| 16224 | 118048 | } | |
| 16225 | ✗ | else if((Header->zelda_version == 0x192)&&(Header->build>23)&&(Header->build<98)) | |
| 16226 | { | ||
| 16227 | ✗ | if(!p_getc(&(temp_mapscr->layermap[2]),f,true)) | |
| 16228 | { | ||
| 16229 | ✗ | return qe_invalid; | |
| 16230 | } | ||
| 16231 | |||
| 16232 | ✗ | if(!p_getc(&(temp_mapscr->layerscreen[2]),f,true)) | |
| 16233 | { | ||
| 16234 | ✗ | return qe_invalid; | |
| 16235 | } | ||
| 16236 | |||
| 16237 | ✗ | if(!p_getc(&(temp_mapscr->layermap[4]),f,true)) | |
| 16238 | { | ||
| 16239 | ✗ | return qe_invalid; | |
| 16240 | } | ||
| 16241 | |||
| 16242 | ✗ | if(!p_getc(&(temp_mapscr->layerscreen[4]),f,true)) | |
| 16243 | |||
| 16244 | { | ||
| 16245 | ✗ | return qe_invalid; | |
| 16246 | } | ||
| 16247 | } | ||
| 16248 | |||
| 16249 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
118048 | if((Header->zelda_version == 0x192)&&(Header->build>149)) |
| 16250 | { | ||
| 16251 | ✗ | for(int32_t k=0; k<6; k++) | |
| 16252 | { | ||
| 16253 | ✗ | if(!p_getc(&tempbyte,f,true)) //layerxsize | |
| 16254 | { | ||
| 16255 | ✗ | return qe_invalid; | |
| 16256 | } | ||
| 16257 | } | ||
| 16258 | |||
| 16259 | ✗ | for(int32_t k=0; k<6; k++) | |
| 16260 | { | ||
| 16261 | ✗ | if(!p_getc(&tempbyte,f,true)) //layerxspeed | |
| 16262 | { | ||
| 16263 | ✗ | return qe_invalid; | |
| 16264 | } | ||
| 16265 | } | ||
| 16266 | |||
| 16267 | ✗ | for(int32_t k=0; k<6; k++) | |
| 16268 | { | ||
| 16269 | ✗ | if(!p_getc(&tempbyte,f,true)) //layerxdelay | |
| 16270 | { | ||
| 16271 | ✗ | return qe_invalid; | |
| 16272 | } | ||
| 16273 | } | ||
| 16274 | |||
| 16275 | ✗ | for(int32_t k=0; k<6; k++) | |
| 16276 | { | ||
| 16277 | ✗ | if(!p_getc(&tempbyte,f,true)) //layerysize | |
| 16278 | { | ||
| 16279 | ✗ | return qe_invalid; | |
| 16280 | } | ||
| 16281 | } | ||
| 16282 | |||
| 16283 | ✗ | for(int32_t k=0; k<6; k++) | |
| 16284 | { | ||
| 16285 | ✗ | if(!p_getc(&tempbyte,f,true)) //layeryspeed | |
| 16286 | { | ||
| 16287 | ✗ | return qe_invalid; | |
| 16288 | } | ||
| 16289 | } | ||
| 16290 | |||
| 16291 | ✗ | for(int32_t k=0; k<6; k++) | |
| 16292 | { | ||
| 16293 | ✗ | if(!p_getc(&tempbyte,f,true)) //layerydelay | |
| 16294 | { | ||
| 16295 | ✗ | return qe_invalid; | |
| 16296 | } | ||
| 16297 | } | ||
| 16298 | } | ||
| 16299 | |||
| 16300 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>149))) |
| 16301 | { | ||
| 16302 |
2/2✓ Branch 0 taken 708288 times.
✓ Branch 1 taken 118048 times.
|
826336 | for(int32_t k=0; k<6; k++) |
| 16303 | { | ||
| 16304 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 708288 times.
|
708288 | if(!p_getc(&(temp_mapscr->layeropacity[k]),f,true)) |
| 16305 | { | ||
| 16306 | ✗ | return qe_invalid; | |
| 16307 | } | ||
| 16308 | 708288 | } | |
| 16309 | 118048 | } | |
| 16310 | |||
| 16311 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>153))) |
| 16312 | { | ||
| 16313 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
118048 | if((Header->zelda_version == 0x192)&&(Header->build>153)) |
| 16314 | { | ||
| 16315 | ✗ | if(!p_getc(&padding,f,true)) | |
| 16316 | { | ||
| 16317 | ✗ | return qe_invalid; | |
| 16318 | } | ||
| 16319 | } | ||
| 16320 | |||
| 16321 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_igetw(&(temp_mapscr->timedwarptics),f,true)) |
| 16322 | { | ||
| 16323 | ✗ | return qe_invalid; | |
| 16324 | } | ||
| 16325 | 118048 | } | |
| 16326 | |||
| 16327 |
2/6✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 118048 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<24))) |
| 16328 | { | ||
| 16329 | ✗ | extras=15; | |
| 16330 | } | ||
| 16331 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
118048 | else if(((Header->zelda_version == 0x192)&&(Header->build<98))) |
| 16332 | { | ||
| 16333 | ✗ | extras=11; | |
| 16334 | } | ||
| 16335 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
118048 | else if((Header->zelda_version == 0x192)&&(Header->build<150)) |
| 16336 | { | ||
| 16337 | ✗ | extras=32; | |
| 16338 | } | ||
| 16339 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
118048 | else if((Header->zelda_version == 0x192)&&(Header->build<154)) |
| 16340 | { | ||
| 16341 | ✗ | extras=64; | |
| 16342 | } | ||
| 16343 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | else if(Header->zelda_version < 0x193) |
| 16344 | { | ||
| 16345 | ✗ | extras=62; | |
| 16346 | } | ||
| 16347 | else | ||
| 16348 | |||
| 16349 | { | ||
| 16350 | 118048 | extras=0; | |
| 16351 | } | ||
| 16352 | |||
| 16353 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | for(int32_t k=0; k<extras; k++) |
| 16354 | { | ||
| 16355 | ✗ | if(!p_getc(&tempbyte,f,true)) //extra[k] | |
| 16356 | { | ||
| 16357 | ✗ | return qe_invalid; | |
| 16358 | } | ||
| 16359 | } | ||
| 16360 | |||
| 16361 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>2))) |
| 16362 | //if (version>3) | ||
| 16363 | { | ||
| 16364 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_getc(&(temp_mapscr->nextmap),f,true)) |
| 16365 | { | ||
| 16366 | ✗ | return qe_invalid; | |
| 16367 | } | ||
| 16368 | |||
| 16369 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->nextscr),f,true)) |
| 16370 | { | ||
| 16371 | ✗ | return qe_invalid; | |
| 16372 | } | ||
| 16373 | 118048 | } | |
| 16374 | else | ||
| 16375 | { | ||
| 16376 | ✗ | temp_mapscr->nextmap=0; | |
| 16377 | ✗ | temp_mapscr->nextscr=0; | |
| 16378 | } | ||
| 16379 | |||
| 16380 |
2/6✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 118048 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 16381 | { | ||
| 16382 | ✗ | secretcombos=20; | |
| 16383 | } | ||
| 16384 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
118048 | else if((Header->zelda_version == 0x192)&&(Header->build<154)) |
| 16385 | { | ||
| 16386 | ✗ | secretcombos=256; | |
| 16387 | } | ||
| 16388 | else | ||
| 16389 | { | ||
| 16390 | 118048 | secretcombos=128; | |
| 16391 | } | ||
| 16392 | |||
| 16393 |
2/6✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 118048 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 16394 | { | ||
| 16395 | ✗ | for(int32_t k=0; k<secretcombos; k++) | |
| 16396 | { | ||
| 16397 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 16398 | { | ||
| 16399 | ✗ | return qe_invalid; | |
| 16400 | } | ||
| 16401 | |||
| 16402 | ✗ | if(k<128) | |
| 16403 | { | ||
| 16404 | ✗ | temp_mapscr->secretcombo[k]=tempbyte; | |
| 16405 | } | ||
| 16406 | } | ||
| 16407 | } | ||
| 16408 | else | ||
| 16409 | { | ||
| 16410 |
2/2✓ Branch 0 taken 15110144 times.
✓ Branch 1 taken 118048 times.
|
15228192 | for(int32_t k=0; k<128; k++) |
| 16411 | { | ||
| 16412 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15110144 times.
|
15110144 | if(!p_igetw(&(temp_mapscr->secretcombo[k]),f,true)) |
| 16413 | { | ||
| 16414 | ✗ | return qe_invalid; | |
| 16415 | } | ||
| 16416 | |||
| 16417 | 15110144 | } | |
| 16418 | } | ||
| 16419 | |||
| 16420 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>153))) |
| 16421 | { | ||
| 16422 |
2/2✓ Branch 0 taken 15110144 times.
✓ Branch 1 taken 118048 times.
|
15228192 | for(int32_t k=0; k<128; k++) |
| 16423 | { | ||
| 16424 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15110144 times.
|
15110144 | if(!p_getc(&(temp_mapscr->secretcset[k]),f,true)) |
| 16425 | { | ||
| 16426 | ✗ | return qe_invalid; | |
| 16427 | } | ||
| 16428 | 15110144 | } | |
| 16429 | |||
| 16430 |
2/2✓ Branch 0 taken 15110144 times.
✓ Branch 1 taken 118048 times.
|
15228192 | for(int32_t k=0; k<128; k++) |
| 16431 | { | ||
| 16432 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15110144 times.
|
15110144 | if(!p_getc(&(temp_mapscr->secretflag[k]),f,true)) |
| 16433 | { | ||
| 16434 | ✗ | return qe_invalid; | |
| 16435 | } | ||
| 16436 | 15110144 | } | |
| 16437 | 118048 | } | |
| 16438 | |||
| 16439 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version == 0x192)&&(Header->build>97)&&(Header->build<154)) |
| 16440 | { | ||
| 16441 | ✗ | if(!p_getc(&padding,f,true)) | |
| 16442 | { | ||
| 16443 | ✗ | return qe_invalid; | |
| 16444 | } | ||
| 16445 | } | ||
| 16446 | |||
| 16447 | 118048 | const int32_t _mapsSize = (temp_map->tileWidth*temp_map->tileHeight); | |
| 16448 | |||
| 16449 |
2/2✓ Branch 0 taken 20776448 times.
✓ Branch 1 taken 118048 times.
|
20894496 | for(int32_t k=0; k<(temp_map->tileWidth*temp_map->tileHeight); k++) |
| 16450 | { | ||
| 16451 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20776448 times.
|
20776448 | if(!p_igetw(&(temp_mapscr->data[k]),f,true)) |
| 16452 | { | ||
| 16453 | ✗ | return qe_invalid; | |
| 16454 | } | ||
| 16455 | 20776448 | } | |
| 16456 | |||
| 16457 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version == 0x192)&&(Header->build>20)&&(Header->build<24)) |
| 16458 | { | ||
| 16459 | ✗ | if(!p_getc(&padding,f,true)) | |
| 16460 | { | ||
| 16461 | ✗ | return qe_invalid; | |
| 16462 | } | ||
| 16463 | |||
| 16464 | ✗ | if(!p_getc(&padding,f,true)) | |
| 16465 | { | ||
| 16466 | ✗ | return qe_invalid; | |
| 16467 | } | ||
| 16468 | } | ||
| 16469 | |||
| 16470 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>20))) |
| 16471 | { | ||
| 16472 |
2/2✓ Branch 0 taken 20776448 times.
✓ Branch 1 taken 118048 times.
|
20894496 | for(int32_t k=0; k<(temp_map->tileWidth*temp_map->tileHeight); k++) |
| 16473 | { | ||
| 16474 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20776448 times.
|
20776448 | if(!p_getc(&(temp_mapscr->sflag[k]),f,true)) |
| 16475 | { | ||
| 16476 | ✗ | return qe_invalid; | |
| 16477 | } | ||
| 16478 | |||
| 16479 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 20776448 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
20776448 | if((Header->zelda_version == 0x192)&&(Header->build<24)) |
| 16480 | { | ||
| 16481 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 16482 | { | ||
| 16483 | ✗ | return qe_invalid; | |
| 16484 | } | ||
| 16485 | |||
| 16486 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 16487 | { | ||
| 16488 | ✗ | return qe_invalid; | |
| 16489 | } | ||
| 16490 | |||
| 16491 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 16492 | { | ||
| 16493 | ✗ | return qe_invalid; | |
| 16494 | } | ||
| 16495 | } | ||
| 16496 | 20776448 | } | |
| 16497 | 118048 | } | |
| 16498 | |||
| 16499 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>97))) |
| 16500 | { | ||
| 16501 |
2/2✓ Branch 0 taken 118048 times.
✓ Branch 1 taken 20776448 times.
|
20894496 | for(int32_t k=0; k<(temp_map->tileWidth*temp_map->tileHeight); k++) |
| 16502 | { | ||
| 16503 | |||
| 16504 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20776448 times.
|
20776448 | if(!p_getc(&(temp_mapscr->cset[k]),f,true)) |
| 16505 | { | ||
| 16506 | ✗ | return qe_invalid; | |
| 16507 | } | ||
| 16508 | 20776448 | } | |
| 16509 | 118048 | } | |
| 16510 | |||
| 16511 |
2/6✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 118048 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 16512 | { | ||
| 16513 | ✗ | temp_mapscr->undercset=(temp_mapscr->undercombo>>8)&7; | |
| 16514 | ✗ | temp_mapscr->undercombo=(temp_mapscr->undercombo&0xFF)+(temp_mapscr->old_cpage<<8); | |
| 16515 | } | ||
| 16516 | |||
| 16517 |
2/6✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 118048 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 16518 | { | ||
| 16519 | ✗ | temp_mapscr->secretcombo[sSBOMB]=temp_mapscr->secretcombo[sBOMB]; | |
| 16520 | ✗ | temp_mapscr->secretcombo[sRCANDLE]=temp_mapscr->secretcombo[sBCANDLE]; | |
| 16521 | ✗ | temp_mapscr->secretcombo[sWANDFIRE]=temp_mapscr->secretcombo[sBCANDLE]; | |
| 16522 | ✗ | temp_mapscr->secretcombo[sDINSFIRE]=temp_mapscr->secretcombo[sBCANDLE]; | |
| 16523 | ✗ | temp_mapscr->secretcombo[sSARROW]=temp_mapscr->secretcombo[sARROW]; | |
| 16524 | ✗ | temp_mapscr->secretcombo[sGARROW]=temp_mapscr->secretcombo[sARROW]; | |
| 16525 | } | ||
| 16526 | |||
| 16527 |
2/6✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 118048 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
118048 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 16528 | { | ||
| 16529 | ✗ | for(int32_t k=0; k<(temp_map->tileWidth*temp_map->tileHeight); k++) | |
| 16530 | { | ||
| 16531 | ✗ | if((Header->zelda_version == 0x192)&&(Header->build>149)) | |
| 16532 | { | ||
| 16533 | ✗ | if((Header->zelda_version == 0x192)&&(Header->build!=153)) | |
| 16534 | { | ||
| 16535 | ✗ | temp_mapscr->cset[k]=((temp_mapscr->data[k]>>8)&7); | |
| 16536 | } | ||
| 16537 | } | ||
| 16538 | else | ||
| 16539 | { | ||
| 16540 | ✗ | if((Header->zelda_version < 0x192)|| | |
| 16541 | ✗ | ((Header->zelda_version == 0x192)&&(Header->build<21))) | |
| 16542 | { | ||
| 16543 | ✗ | temp_mapscr->sflag[k]=(temp_mapscr->data[k]>>11); | |
| 16544 | } | ||
| 16545 | |||
| 16546 | ✗ | temp_mapscr->cset[k]=((temp_mapscr->data[k]>>8)&7); | |
| 16547 | } | ||
| 16548 | |||
| 16549 | ✗ | temp_mapscr->data[k]=(temp_mapscr->data[k]&0xFF)+(temp_mapscr->old_cpage<<8); | |
| 16550 | } | ||
| 16551 | } | ||
| 16552 | |||
| 16553 | /*if(version>12) | ||
| 16554 | { | ||
| 16555 | if(!p_getc(&(temp_mapscr->scrWidth),f,true)) | ||
| 16556 | { | ||
| 16557 | return qe_invalid; | ||
| 16558 | } | ||
| 16559 | if(!p_getc(&(temp_mapscr->scrHeight),f,true)) | ||
| 16560 | { | ||
| 16561 | return qe_invalid; | ||
| 16562 | } | ||
| 16563 | }*/ | ||
| 16564 | |||
| 16565 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(version>4) |
| 16566 | { | ||
| 16567 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_igetw(&(temp_mapscr->screen_midi),f,true)) |
| 16568 | { | ||
| 16569 | ✗ | return qe_invalid; | |
| 16570 | } | ||
| 16571 | 118048 | } | |
| 16572 | else | ||
| 16573 | { | ||
| 16574 | ✗ | temp_mapscr->screen_midi = -1; | |
| 16575 | } | ||
| 16576 | |||
| 16577 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(version>=17) |
| 16578 | { | ||
| 16579 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(!p_getc(&(temp_mapscr->lens_layer),f,true)) |
| 16580 | { | ||
| 16581 | ✗ | return qe_invalid; | |
| 16582 | } | ||
| 16583 | 118048 | } | |
| 16584 | else | ||
| 16585 | { | ||
| 16586 | ✗ | temp_mapscr->lens_layer = llNORMAL; | |
| 16587 | } | ||
| 16588 | |||
| 16589 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(version>6) |
| 16590 | { | ||
| 16591 | dword bits; | ||
| 16592 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118048 times.
|
118048 | if(!p_igetl(&bits,f,true)) |
| 16593 | { | ||
| 16594 | ✗ | return qe_invalid; | |
| 16595 | } | ||
| 16596 | |||
| 16597 | int32_t m; | ||
| 16598 | float tempfloat; | ||
| 16599 | word tempw; | ||
| 16600 | |||
| 16601 |
2/2✓ Branch 0 taken 118048 times.
✓ Branch 1 taken 3777536 times.
|
3895584 | for(m=0; m<32; m++) |
| 16602 | { | ||
| 16603 | 3777536 | ffcdata& tempffc = temp_mapscr->ffcs[m]; | |
| 16604 | 3777536 | tempffc.clear(); | |
| 16605 |
2/2✓ Branch 0 taken 3767532 times.
✓ Branch 1 taken 10004 times.
|
3777536 | if((bits>>m)&1) |
| 16606 | { | ||
| 16607 |
1/2✓ Branch 0 taken 10004 times.
✗ Branch 1 not taken.
|
10004 | if(!p_igetw(&tempw,f,true)) |
| 16608 | { | ||
| 16609 | ✗ | return qe_invalid; | |
| 16610 | } | ||
| 16611 | 10004 | tempffc.setData(tempw); | |
| 16612 | |||
| 16613 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_getc(&(tempffc.cset),f,true)) |
| 16614 | { | ||
| 16615 | ✗ | return qe_invalid; | |
| 16616 | } | ||
| 16617 | |||
| 16618 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_igetw(&(tempffc.delay),f,true)) |
| 16619 | { | ||
| 16620 | ✗ | return qe_invalid; | |
| 16621 | } | ||
| 16622 | |||
| 16623 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(version < 9) |
| 16624 | { | ||
| 16625 | ✗ | if(!p_igetf(&tempfloat,f,true)) | |
| 16626 | { | ||
| 16627 | ✗ | return qe_invalid; | |
| 16628 | } | ||
| 16629 | |||
| 16630 | ✗ | tempffc.x=zslongToFix(int32_t(tempfloat*10000)); | |
| 16631 | |||
| 16632 | ✗ | if(!p_igetf(&tempfloat,f,true)) | |
| 16633 | { | ||
| 16634 | ✗ | return qe_invalid; | |
| 16635 | } | ||
| 16636 | |||
| 16637 | ✗ | tempffc.y=zslongToFix(int32_t(tempfloat*10000)); | |
| 16638 | |||
| 16639 | ✗ | if(!p_igetf(&tempfloat,f,true)) | |
| 16640 | { | ||
| 16641 | ✗ | return qe_invalid; | |
| 16642 | } | ||
| 16643 | |||
| 16644 | ✗ | tempffc.vx=zslongToFix(int32_t(tempfloat*10000)); | |
| 16645 | |||
| 16646 | ✗ | if(!p_igetf(&tempfloat,f,true)) | |
| 16647 | { | ||
| 16648 | ✗ | return qe_invalid; | |
| 16649 | } | ||
| 16650 | |||
| 16651 | ✗ | tempffc.vy=zslongToFix(int32_t(tempfloat*10000)); | |
| 16652 | |||
| 16653 | ✗ | if(!p_igetf(&tempfloat,f,true)) | |
| 16654 | { | ||
| 16655 | ✗ | return qe_invalid; | |
| 16656 | } | ||
| 16657 | |||
| 16658 | ✗ | tempffc.ax=zslongToFix(int32_t(tempfloat*10000)); | |
| 16659 | |||
| 16660 | ✗ | if(!p_igetf(&tempfloat,f,true)) | |
| 16661 | { | ||
| 16662 | ✗ | return qe_invalid; | |
| 16663 | } | ||
| 16664 | |||
| 16665 | ✗ | tempffc.ay=zslongToFix(int32_t(tempfloat*10000)); | |
| 16666 | } | ||
| 16667 | else | ||
| 16668 | { | ||
| 16669 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_igetzf(&(tempffc.x),f,true)) |
| 16670 | { | ||
| 16671 | ✗ | return qe_invalid; | |
| 16672 | } | ||
| 16673 | |||
| 16674 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_igetzf(&(tempffc.y),f,true)) |
| 16675 | { | ||
| 16676 | ✗ | return qe_invalid; | |
| 16677 | } | ||
| 16678 | |||
| 16679 |
1/2✓ Branch 0 taken 10004 times.
✗ Branch 1 not taken.
|
10004 | if(!p_igetzf(&(tempffc.vx),f,true)) |
| 16680 | { | ||
| 16681 | ✗ | return qe_invalid; | |
| 16682 | } | ||
| 16683 | |||
| 16684 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_igetzf(&(tempffc.vy),f,true)) |
| 16685 | { | ||
| 16686 | ✗ | return qe_invalid; | |
| 16687 | } | ||
| 16688 | |||
| 16689 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_igetzf(&(tempffc.ax),f,true)) |
| 16690 | { | ||
| 16691 | ✗ | return qe_invalid; | |
| 16692 | } | ||
| 16693 | |||
| 16694 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_igetzf(&(tempffc.ay),f,true)) |
| 16695 | { | ||
| 16696 | ✗ | return qe_invalid; | |
| 16697 | } | ||
| 16698 | } | ||
| 16699 | |||
| 16700 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_getc(&(tempffc.link),f,true)) |
| 16701 | { | ||
| 16702 | ✗ | return qe_invalid; | |
| 16703 | } | ||
| 16704 | |||
| 16705 |
1/2✓ Branch 0 taken 10004 times.
✗ Branch 1 not taken.
|
10004 | if(version>7) |
| 16706 | { | ||
| 16707 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_getc(&tempbyte,f,true)) |
| 16708 | { | ||
| 16709 | ✗ | return qe_invalid; | |
| 16710 | } | ||
| 16711 | |||
| 16712 | 10004 | tempffc.hxsz = (tempbyte&0x3F)+1; | |
| 16713 | 10004 | tempffc.txsz = (tempbyte>>6)+1; | |
| 16714 | |||
| 16715 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_getc(&tempbyte,f,true)) |
| 16716 | { | ||
| 16717 | ✗ | return qe_invalid; | |
| 16718 | } | ||
| 16719 | |||
| 16720 | 10004 | tempffc.hysz = (tempbyte&0x3F)+1; | |
| 16721 | 10004 | tempffc.tysz = (tempbyte>>6)+1; | |
| 16722 | |||
| 16723 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_igetl(&(tempffc.flags),f,true)) |
| 16724 | { | ||
| 16725 | ✗ | return qe_invalid; | |
| 16726 | } | ||
| 16727 | 10004 | } | |
| 16728 | else | ||
| 16729 | { | ||
| 16730 | ✗ | tempffc.hxsz=16; | |
| 16731 | ✗ | tempffc.hysz=16; | |
| 16732 | ✗ | tempffc.txsz=1; | |
| 16733 | ✗ | tempffc.tysz=1; | |
| 16734 | ✗ | tempffc.flags=0; | |
| 16735 | } | ||
| 16736 | |||
| 16737 | 10004 | tempffc.updateSolid(); | |
| 16738 | |||
| 16739 | |||
| 16740 |
4/6✓ Branch 0 taken 10004 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8040 times.
✓ Branch 3 taken 1964 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 8040 times.
|
10004 | if(Header->zelda_version == 0x211 || (Header->zelda_version == 0x250 && Header->build<20)) |
| 16741 | { | ||
| 16742 | ✗ | tempffc.flags|=ffIGNOREHOLDUP; | |
| 16743 | } | ||
| 16744 | |||
| 16745 |
1/2✓ Branch 0 taken 10004 times.
✗ Branch 1 not taken.
|
10004 | if(version>9) |
| 16746 | { | ||
| 16747 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_igetw(&(tempffc.script),f,true)) |
| 16748 | { | ||
| 16749 | ✗ | return qe_invalid; | |
| 16750 | } | ||
| 16751 | 10004 | } | |
| 16752 | else | ||
| 16753 | { | ||
| 16754 | ✗ | tempffc.script=0; | |
| 16755 | } | ||
| 16756 | |||
| 16757 |
1/2✓ Branch 0 taken 10004 times.
✗ Branch 1 not taken.
|
10004 | if(version>10) |
| 16758 | { | ||
| 16759 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_igetl(&(tempffc.initd[0]),f,true)) |
| 16760 | { | ||
| 16761 | ✗ | return qe_invalid; | |
| 16762 | } | ||
| 16763 | |||
| 16764 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_igetl(&(tempffc.initd[1]),f,true)) |
| 16765 | { | ||
| 16766 | ✗ | return qe_invalid; | |
| 16767 | } | ||
| 16768 | |||
| 16769 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_igetl(&(tempffc.initd[2]),f,true)) |
| 16770 | { | ||
| 16771 | ✗ | return qe_invalid; | |
| 16772 | } | ||
| 16773 | |||
| 16774 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_igetl(&(tempffc.initd[3]),f,true)) |
| 16775 | { | ||
| 16776 | ✗ | return qe_invalid; | |
| 16777 | } | ||
| 16778 | |||
| 16779 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_igetl(&(tempffc.initd[4]),f,true)) |
| 16780 | { | ||
| 16781 | ✗ | return qe_invalid; | |
| 16782 | } | ||
| 16783 | |||
| 16784 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_igetl(&(tempffc.initd[5]),f,true)) |
| 16785 | { | ||
| 16786 | ✗ | return qe_invalid; | |
| 16787 | } | ||
| 16788 | |||
| 16789 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_igetl(&(tempffc.initd[6]),f,true)) |
| 16790 | { | ||
| 16791 | ✗ | return qe_invalid; | |
| 16792 | } | ||
| 16793 | |||
| 16794 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_igetl(&(tempffc.initd[7]),f,true)) |
| 16795 | { | ||
| 16796 | ✗ | return qe_invalid; | |
| 16797 | } | ||
| 16798 | |||
| 16799 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_getc(&(tempbyte),f,true)) |
| 16800 | { | ||
| 16801 | ✗ | return qe_invalid; | |
| 16802 | } | ||
| 16803 | |||
| 16804 | 10004 | tempffc.inita[0]=tempbyte*10000; | |
| 16805 | |||
| 16806 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10004 times.
|
10004 | if(!p_getc(&(tempbyte),f,true)) |
| 16807 | { | ||
| 16808 | ✗ | return qe_invalid; | |
| 16809 | } | ||
| 16810 | |||
| 16811 | 10004 | tempffc.inita[1]=tempbyte*10000; | |
| 16812 | 10004 | } | |
| 16813 | else | ||
| 16814 | { | ||
| 16815 | ✗ | tempffc.inita[0] = 10000; | |
| 16816 | ✗ | tempffc.inita[1] = 10000; | |
| 16817 | } | ||
| 16818 | |||
| 16819 | 10004 | tempffc.initialized = false; | |
| 16820 | |||
| 16821 |
1/2✓ Branch 0 taken 10004 times.
✗ Branch 1 not taken.
|
10004 | if(version <= 11) |
| 16822 | { | ||
| 16823 | ✗ | fixffcs=true; | |
| 16824 | } | ||
| 16825 | 10004 | } | |
| 16826 | 3777536 | } | |
| 16827 | |||
| 16828 | 118048 | } | |
| 16829 | |||
| 16830 | //add in the new whistle flags | ||
| 16831 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(version<13) |
| 16832 | { | ||
| 16833 | ✗ | if(temp_mapscr->flags & fWHISTLE) | |
| 16834 | { | ||
| 16835 | ✗ | temp_mapscr->flags7 |= (fWHISTLEPAL | fWHISTLEWATER); | |
| 16836 | } | ||
| 16837 | } | ||
| 16838 | |||
| 16839 | // for(int32_t m=0; m<32; m++) | ||
| 16840 | // { | ||
| 16841 | // // ffcScriptData used to be part of mapscr, and this was handled just above | ||
| 16842 | // ffcScriptData[m].a[0] = 10000; | ||
| 16843 | // ffcScriptData[m].a[1] = 10000; | ||
| 16844 | // } | ||
| 16845 | |||
| 16846 | //2.55 starts here | ||
| 16847 |
3/4✓ Branch 0 taken 6936 times.
✓ Branch 1 taken 111112 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6936 times.
|
118048 | if ( version >= 19 && Header->zelda_version > 0x253 ) |
| 16848 | { | ||
| 16849 |
2/2✓ Branch 0 taken 69360 times.
✓ Branch 1 taken 6936 times.
|
76296 | for ( int32_t q = 0; q < 10; q++ ) |
| 16850 | { | ||
| 16851 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69360 times.
|
69360 | if(!p_igetl(&(temp_mapscr->npcstrings[q]),f,true)) |
| 16852 | { | ||
| 16853 | ✗ | return qe_invalid; | |
| 16854 | } | ||
| 16855 | 69360 | } | |
| 16856 |
2/2✓ Branch 0 taken 69360 times.
✓ Branch 1 taken 6936 times.
|
76296 | for ( int32_t q = 0; q < 10; q++ ) |
| 16857 | { | ||
| 16858 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69360 times.
|
69360 | if(!p_igetw(&(temp_mapscr->new_items[q]),f,true)) |
| 16859 | { | ||
| 16860 | ✗ | return qe_invalid; | |
| 16861 | } | ||
| 16862 | 69360 | } | |
| 16863 |
2/2✓ Branch 0 taken 69360 times.
✓ Branch 1 taken 6936 times.
|
76296 | for ( int32_t q = 0; q < 10; q++ ) |
| 16864 | { | ||
| 16865 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69360 times.
|
69360 | if(!p_igetw(&(temp_mapscr->new_item_x[q]),f,true)) |
| 16866 | { | ||
| 16867 | ✗ | return qe_invalid; | |
| 16868 | } | ||
| 16869 | 69360 | } | |
| 16870 |
2/2✓ Branch 0 taken 6936 times.
✓ Branch 1 taken 69360 times.
|
76296 | for ( int32_t q = 0; q < 10; q++ ) |
| 16871 | { | ||
| 16872 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69360 times.
|
69360 | if(!p_igetw(&(temp_mapscr->new_item_y[q]),f,true)) |
| 16873 | { | ||
| 16874 | ✗ | return qe_invalid; | |
| 16875 | } | ||
| 16876 | 69360 | } | |
| 16877 | 6936 | } | |
| 16878 |
3/4✓ Branch 0 taken 111112 times.
✓ Branch 1 taken 6936 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 111112 times.
|
118048 | if ( version < 19 && Header->zelda_version > 0x253 ) |
| 16879 | { | ||
| 16880 | ✗ | for ( int32_t q = 0; q < 10; q++ ) | |
| 16881 | { | ||
| 16882 | ✗ | temp_mapscr->npcstrings[q] = 0; | |
| 16883 | ✗ | temp_mapscr->new_items[q] = 0; | |
| 16884 | ✗ | temp_mapscr->new_item_x[q] = 0; | |
| 16885 | ✗ | temp_mapscr->new_item_y[q] = 0; | |
| 16886 | } | ||
| 16887 | } | ||
| 16888 |
3/4✓ Branch 0 taken 6936 times.
✓ Branch 1 taken 111112 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6936 times.
|
118048 | if ( version >= 20 && Header->zelda_version > 0x253 ) |
| 16889 | { | ||
| 16890 |
1/2✓ Branch 0 taken 6936 times.
✗ Branch 1 not taken.
|
6936 | if(!p_igetw(&(temp_mapscr->script),f,true)) |
| 16891 | { | ||
| 16892 | ✗ | return qe_invalid; | |
| 16893 | } | ||
| 16894 |
2/2✓ Branch 0 taken 55488 times.
✓ Branch 1 taken 6936 times.
|
62424 | for ( int32_t q = 0; q < 8; q++) |
| 16895 | { | ||
| 16896 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55488 times.
|
55488 | if(!p_igetl(&(temp_mapscr->screeninitd[q]),f,true)) |
| 16897 | { | ||
| 16898 | ✗ | return qe_invalid; | |
| 16899 | } | ||
| 16900 | 55488 | } | |
| 16901 | 6936 | } | |
| 16902 |
2/2✓ Branch 0 taken 6936 times.
✓ Branch 1 taken 111112 times.
|
118048 | if ( version < 20 ) |
| 16903 | { | ||
| 16904 | 111112 | temp_mapscr->script = 0; | |
| 16905 |
2/2✓ Branch 0 taken 888896 times.
✓ Branch 1 taken 111112 times.
|
1000008 | for ( int32_t q = 0; q < 8; q++) temp_mapscr->screeninitd[q] = 0; |
| 16906 | 111112 | } | |
| 16907 |
3/4✓ Branch 0 taken 6936 times.
✓ Branch 1 taken 111112 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6936 times.
|
118048 | if ( version >= 21 && Header->zelda_version > 0x253 ) |
| 16908 | { | ||
| 16909 |
1/2✓ Branch 0 taken 6936 times.
✗ Branch 1 not taken.
|
6936 | if(!p_getc(&(temp_mapscr->preloadscript),f,true)) |
| 16910 | { | ||
| 16911 | ✗ | return qe_invalid; | |
| 16912 | } | ||
| 16913 | 6936 | } | |
| 16914 |
2/2✓ Branch 0 taken 111112 times.
✓ Branch 1 taken 6936 times.
|
118048 | if ( version < 21 ) |
| 16915 | { | ||
| 16916 | 111112 | temp_mapscr->preloadscript = 0; | |
| 16917 | 111112 | } | |
| 16918 | //all builds with version > 20 need this. -Z | ||
| 16919 | 118048 | temp_mapscr->ffcswaitdraw = 0; | |
| 16920 | |||
| 16921 |
3/4✓ Branch 0 taken 6936 times.
✓ Branch 1 taken 111112 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6936 times.
|
118048 | if ( version >= 22 && Header->zelda_version > 0x253 ) //26th June, 2019; Layer Visibility |
| 16922 | { | ||
| 16923 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6936 times.
|
6936 | if(!p_getc(&(temp_mapscr->hidelayers ),f,true)) |
| 16924 | { | ||
| 16925 | ✗ | return qe_invalid; | |
| 16926 | } | ||
| 16927 |
1/2✓ Branch 0 taken 6936 times.
✗ Branch 1 not taken.
|
6936 | if(!p_getc(&(temp_mapscr->hidescriptlayers ),f,true)) |
| 16928 | { | ||
| 16929 | ✗ | return qe_invalid; | |
| 16930 | } | ||
| 16931 | 6936 | } | |
| 16932 |
2/2✓ Branch 0 taken 111112 times.
✓ Branch 1 taken 6936 times.
|
118048 | if ( version < 22 ) |
| 16933 | { | ||
| 16934 | 111112 | temp_mapscr->hidelayers = 0; | |
| 16935 | 111112 | temp_mapscr->hidescriptlayers = 0; | |
| 16936 | 111112 | } | |
| 16937 | |||
| 16938 | //Dodongos in 2.10 used the boss roar, not the dodongo sound. -Z | ||
| 16939 | //May be any version before 2.11. -Z | ||
| 16940 | /* --not the roar, the HIT SFX | ||
| 16941 | if ( Header->zelda_version <= 0x210 ) | ||
| 16942 | { | ||
| 16943 | if ( temp_mapscr->bosssfx == WAV_DODONGO ) | ||
| 16944 | { | ||
| 16945 | temp_mapscr->bosssfx = WAV_ROAR; | ||
| 16946 | } | ||
| 16947 | } | ||
| 16948 | */ | ||
| 16949 | |||
| 16950 | 118048 | return 0; | |
| 16951 | 118048 | } | |
| 16952 | 126208 | int32_t readmapscreen(PACKFILE *f, zquestheader *Header, mapscr *temp_mapscr, zcmap *temp_map, word version) | |
| 16953 | { | ||
| 16954 |
2/2✓ Branch 0 taken 118048 times.
✓ Branch 1 taken 8160 times.
|
126208 | if(version < 23) |
| 16955 | { | ||
| 16956 | 118048 | auto ret = readmapscreen_old(f,Header,temp_mapscr,temp_map,version); | |
| 16957 |
1/2✓ Branch 0 taken 118048 times.
✗ Branch 1 not taken.
|
118048 | if(ret) return ret; |
| 16958 | 118048 | temp_mapscr->update_ffc_count(31); | |
| 16959 | 118048 | } | |
| 16960 | else | ||
| 16961 | { | ||
| 16962 |
1/2✓ Branch 0 taken 8160 times.
✗ Branch 1 not taken.
|
8160 | if(!p_getc(&(temp_mapscr->valid),f,true)) |
| 16963 | ✗ | return qe_invalid; | |
| 16964 |
2/2✓ Branch 0 taken 4476 times.
✓ Branch 1 taken 3684 times.
|
8160 | if(!(temp_mapscr->valid & mVALID)) |
| 16965 | 3684 | return 0; //Empty screen | |
| 16966 | uint32_t scr_has_flags; | ||
| 16967 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4476 times.
|
4476 | if(!p_igetl(&scr_has_flags,f,true)) |
| 16968 | ✗ | return qe_invalid; | |
| 16969 | |||
| 16970 |
2/2✓ Branch 0 taken 4446 times.
✓ Branch 1 taken 30 times.
|
4476 | if(scr_has_flags & SCRHAS_ROOMDATA) |
| 16971 | { | ||
| 16972 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if(!p_getc(&(temp_mapscr->guy),f,true)) |
| 16973 | ✗ | return qe_invalid; | |
| 16974 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if(!p_igetw(&(temp_mapscr->str),f,true)) |
| 16975 | ✗ | return qe_invalid; | |
| 16976 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
|
30 | if(!p_getc(&(temp_mapscr->room),f,true)) |
| 16977 | ✗ | return qe_invalid; | |
| 16978 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if(!p_igetw(&(temp_mapscr->catchall),f,true)) |
| 16979 | ✗ | return qe_invalid; | |
| 16980 | 30 | } | |
| 16981 |
2/2✓ Branch 0 taken 4398 times.
✓ Branch 1 taken 78 times.
|
4476 | if(scr_has_flags & SCRHAS_ITEM) |
| 16982 | { | ||
| 16983 |
1/2✓ Branch 0 taken 78 times.
✗ Branch 1 not taken.
|
78 | if(!p_getc(&(temp_mapscr->item),f,true)) |
| 16984 | ✗ | return qe_invalid; | |
| 16985 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 78 times.
|
78 | if(!p_getc(&(temp_mapscr->hasitem),f,true)) |
| 16986 | ✗ | return qe_invalid; | |
| 16987 |
1/2✓ Branch 0 taken 78 times.
✗ Branch 1 not taken.
|
78 | if(!p_getc(&(temp_mapscr->itemx),f,true)) |
| 16988 | ✗ | return qe_invalid; | |
| 16989 |
1/2✓ Branch 0 taken 78 times.
✗ Branch 1 not taken.
|
78 | if(!p_getc(&(temp_mapscr->itemy),f,true)) |
| 16990 | ✗ | return qe_invalid; | |
| 16991 | 78 | } | |
| 16992 |
2/2✓ Branch 0 taken 4239 times.
✓ Branch 1 taken 237 times.
|
4476 | if(scr_has_flags & (SCRHAS_SWARP|SCRHAS_TWARP)) |
| 16993 | { | ||
| 16994 |
1/2✓ Branch 0 taken 237 times.
✗ Branch 1 not taken.
|
237 | if(!p_igetw(&temp_mapscr->warpreturnc,f,true)) |
| 16995 | ✗ | return qe_invalid; | |
| 16996 | 237 | } | |
| 16997 |
2/2✓ Branch 0 taken 4306 times.
✓ Branch 1 taken 170 times.
|
4476 | if(scr_has_flags & SCRHAS_TWARP) |
| 16998 | { | ||
| 16999 |
2/2✓ Branch 0 taken 680 times.
✓ Branch 1 taken 170 times.
|
850 | for(int32_t i=0; i<4; i++) |
| 17000 | { | ||
| 17001 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 680 times.
|
680 | if(!p_getc(&(temp_mapscr->tilewarptype[i]),f,true)) |
| 17002 | ✗ | return qe_invalid; | |
| 17003 | 680 | } | |
| 17004 |
2/2✓ Branch 0 taken 680 times.
✓ Branch 1 taken 170 times.
|
850 | for(int32_t i=0; i<4; i++) |
| 17005 | { | ||
| 17006 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 680 times.
|
680 | if(!p_igetw(&(temp_mapscr->tilewarpdmap[i]),f,true)) |
| 17007 | ✗ | return qe_invalid; | |
| 17008 | 680 | } | |
| 17009 |
2/2✓ Branch 0 taken 680 times.
✓ Branch 1 taken 170 times.
|
850 | for(int32_t i=0; i<4; i++) |
| 17010 | { | ||
| 17011 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 680 times.
|
680 | if(!p_getc(&(temp_mapscr->tilewarpscr[i]),f,true)) |
| 17012 | ✗ | return qe_invalid; | |
| 17013 | 680 | } | |
| 17014 |
1/2✓ Branch 0 taken 170 times.
✗ Branch 1 not taken.
|
170 | if(!p_getc(&(temp_mapscr->tilewarpoverlayflags),f,true)) |
| 17015 | ✗ | return qe_invalid; | |
| 17016 | 170 | } | |
| 17017 |
2/2✓ Branch 0 taken 4387 times.
✓ Branch 1 taken 89 times.
|
4476 | if(scr_has_flags & SCRHAS_SWARP) |
| 17018 | { | ||
| 17019 |
2/2✓ Branch 0 taken 356 times.
✓ Branch 1 taken 89 times.
|
445 | for(int32_t i=0; i<4; i++) |
| 17020 | { | ||
| 17021 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 356 times.
|
356 | if(!p_getc(&(temp_mapscr->sidewarptype[i]),f,true)) |
| 17022 | ✗ | return qe_invalid; | |
| 17023 | 356 | } | |
| 17024 |
2/2✓ Branch 0 taken 356 times.
✓ Branch 1 taken 89 times.
|
445 | for(int32_t i=0; i<4; i++) |
| 17025 | { | ||
| 17026 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 356 times.
|
356 | if(!p_igetw(&(temp_mapscr->sidewarpdmap[i]),f,true)) |
| 17027 | ✗ | return qe_invalid; | |
| 17028 | 356 | } | |
| 17029 |
2/2✓ Branch 0 taken 356 times.
✓ Branch 1 taken 89 times.
|
445 | for(int32_t i=0; i<4; i++) |
| 17030 | { | ||
| 17031 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 356 times.
|
356 | if(!p_getc(&(temp_mapscr->sidewarpscr[i]),f,true)) |
| 17032 | ✗ | return qe_invalid; | |
| 17033 | 356 | } | |
| 17034 |
1/2✓ Branch 0 taken 89 times.
✗ Branch 1 not taken.
|
89 | if(!p_getc(&(temp_mapscr->sidewarpoverlayflags),f,true)) |
| 17035 | ✗ | return qe_invalid; | |
| 17036 |
1/2✓ Branch 0 taken 89 times.
✗ Branch 1 not taken.
|
89 | if(!p_getc(&(temp_mapscr->sidewarpindex),f,true)) |
| 17037 | ✗ | return qe_invalid; | |
| 17038 | 89 | } | |
| 17039 |
2/2✓ Branch 0 taken 4240 times.
✓ Branch 1 taken 236 times.
|
4476 | if(scr_has_flags & SCRHAS_WARPRET) |
| 17040 | { | ||
| 17041 |
2/2✓ Branch 0 taken 944 times.
✓ Branch 1 taken 236 times.
|
1180 | for(int32_t i=0; i<4; i++) |
| 17042 | { | ||
| 17043 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 944 times.
|
944 | if(!p_getc(&(temp_mapscr->warpreturnx[i]),f,true)) |
| 17044 | ✗ | return qe_invalid; | |
| 17045 | 944 | } | |
| 17046 |
2/2✓ Branch 0 taken 944 times.
✓ Branch 1 taken 236 times.
|
1180 | for(int32_t i=0; i<4; i++) |
| 17047 | { | ||
| 17048 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 944 times.
|
944 | if(!p_getc(&(temp_mapscr->warpreturny[i]),f,true)) |
| 17049 | ✗ | return qe_invalid; | |
| 17050 | 944 | } | |
| 17051 |
1/2✓ Branch 0 taken 236 times.
✗ Branch 1 not taken.
|
236 | if(!p_getc(&(temp_mapscr->warparrivalx),f,true)) |
| 17052 | ✗ | return qe_invalid; | |
| 17053 |
1/2✓ Branch 0 taken 236 times.
✗ Branch 1 not taken.
|
236 | if(!p_getc(&(temp_mapscr->warparrivaly),f,true)) |
| 17054 | ✗ | return qe_invalid; | |
| 17055 | 236 | } | |
| 17056 |
2/2✓ Branch 0 taken 664 times.
✓ Branch 1 taken 3812 times.
|
4476 | if(scr_has_flags & SCRHAS_LAYERS) |
| 17057 | { | ||
| 17058 |
2/2✓ Branch 0 taken 3984 times.
✓ Branch 1 taken 664 times.
|
4648 | for(int32_t k=0; k<6; k++) |
| 17059 | { | ||
| 17060 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3984 times.
|
3984 | if(!p_getc(&(temp_mapscr->layermap[k]),f,true)) |
| 17061 | ✗ | return qe_invalid; | |
| 17062 | 3984 | } | |
| 17063 |
2/2✓ Branch 0 taken 3984 times.
✓ Branch 1 taken 664 times.
|
4648 | for(int32_t k=0; k<6; k++) |
| 17064 | { | ||
| 17065 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3984 times.
|
3984 | if(!p_getc(&(temp_mapscr->layerscreen[k]),f,true)) |
| 17066 | ✗ | return qe_invalid; | |
| 17067 | 3984 | } | |
| 17068 |
2/2✓ Branch 0 taken 3984 times.
✓ Branch 1 taken 664 times.
|
4648 | for(int32_t k=0; k<6; k++) |
| 17069 | { | ||
| 17070 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3984 times.
|
3984 | if(!p_getc(&(temp_mapscr->layeropacity[k]),f,true)) |
| 17071 | ✗ | return qe_invalid; | |
| 17072 | 3984 | } | |
| 17073 |
1/2✓ Branch 0 taken 664 times.
✗ Branch 1 not taken.
|
664 | if(!p_getc(&(temp_mapscr->hidelayers),f,true)) |
| 17074 | ✗ | return qe_invalid; | |
| 17075 |
1/2✓ Branch 0 taken 664 times.
✗ Branch 1 not taken.
|
664 | if(!p_getc(&(temp_mapscr->hidescriptlayers),f,true)) |
| 17076 | ✗ | return qe_invalid; | |
| 17077 | 664 | } | |
| 17078 | else | ||
| 17079 | { | ||
| 17080 |
2/2✓ Branch 0 taken 22872 times.
✓ Branch 1 taken 3812 times.
|
26684 | for(int32_t k=0; k<6; k++) |
| 17081 | { | ||
| 17082 | 22872 | temp_mapscr->layeropacity[k] = 255; | |
| 17083 | 22872 | } | |
| 17084 | } | ||
| 17085 |
1/2✓ Branch 0 taken 4476 times.
✗ Branch 1 not taken.
|
4476 | if(scr_has_flags & SCRHAS_MAZE) |
| 17086 | { | ||
| 17087 | ✗ | for(int32_t k=0; k<4; k++) | |
| 17088 | { | ||
| 17089 | ✗ | if(!p_getc(&(temp_mapscr->path[k]),f,true)) | |
| 17090 | ✗ | return qe_invalid; | |
| 17091 | } | ||
| 17092 | ✗ | if(!p_getc(&(temp_mapscr->exitdir),f,true)) | |
| 17093 | ✗ | return qe_invalid; | |
| 17094 | } | ||
| 17095 |
2/2✓ Branch 0 taken 4438 times.
✓ Branch 1 taken 38 times.
|
4476 | if(scr_has_flags & SCRHAS_D_S_U) |
| 17096 | { | ||
| 17097 |
1/2✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
|
38 | if(!p_igetw(&(temp_mapscr->door_combo_set),f,true)) |
| 17098 | ✗ | return qe_invalid; | |
| 17099 |
2/2✓ Branch 0 taken 152 times.
✓ Branch 1 taken 38 times.
|
190 | for(int32_t k=0; k<4; k++) |
| 17100 | { | ||
| 17101 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 152 times.
|
152 | if(!p_getc(&(temp_mapscr->door[k]),f,true)) |
| 17102 | ✗ | return qe_invalid; | |
| 17103 | 152 | } | |
| 17104 | |||
| 17105 |
1/2✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
|
38 | if(!p_getc(&(temp_mapscr->stairx),f,true)) |
| 17106 | ✗ | return qe_invalid; | |
| 17107 | |||
| 17108 |
1/2✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
|
38 | if(!p_getc(&(temp_mapscr->stairy),f,true)) |
| 17109 | ✗ | return qe_invalid; | |
| 17110 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 38 times.
|
38 | if(!p_igetw(&(temp_mapscr->undercombo),f,true)) |
| 17111 | ✗ | return qe_invalid; | |
| 17112 |
1/2✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
|
38 | if(!p_getc(&(temp_mapscr->undercset),f,true)) |
| 17113 | ✗ | return qe_invalid; | |
| 17114 | 38 | } | |
| 17115 |
2/2✓ Branch 0 taken 4190 times.
✓ Branch 1 taken 286 times.
|
4476 | if(scr_has_flags & SCRHAS_FLAGS) |
| 17116 | { | ||
| 17117 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | if(!p_getc(&(temp_mapscr->flags),f,true)) |
| 17118 | ✗ | return qe_invalid; | |
| 17119 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | if(!p_getc(&(temp_mapscr->flags2),f,true)) |
| 17120 | ✗ | return qe_invalid; | |
| 17121 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | if(!p_getc(&(temp_mapscr->flags3),f,true)) |
| 17122 | ✗ | return qe_invalid; | |
| 17123 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | if(!p_getc(&(temp_mapscr->flags4),f,true)) |
| 17124 | ✗ | return qe_invalid; | |
| 17125 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | if(!p_getc(&(temp_mapscr->flags5),f,true)) |
| 17126 | ✗ | return qe_invalid; | |
| 17127 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 286 times.
|
286 | if(!p_getc(&(temp_mapscr->flags6),f,true)) |
| 17128 | ✗ | return qe_invalid; | |
| 17129 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | if(!p_getc(&(temp_mapscr->flags7),f,true)) |
| 17130 | ✗ | return qe_invalid; | |
| 17131 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | if(!p_getc(&(temp_mapscr->flags8),f,true)) |
| 17132 | ✗ | return qe_invalid; | |
| 17133 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | if(!p_getc(&(temp_mapscr->flags9),f,true)) |
| 17134 | ✗ | return qe_invalid; | |
| 17135 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | if(!p_getc(&(temp_mapscr->flags10),f,true)) |
| 17136 | ✗ | return qe_invalid; | |
| 17137 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 286 times.
|
286 | if(!p_getc(&(temp_mapscr->enemyflags),f,true)) |
| 17138 | ✗ | return qe_invalid; | |
| 17139 | 286 | } | |
| 17140 |
2/2✓ Branch 0 taken 4204 times.
✓ Branch 1 taken 272 times.
|
4476 | if(scr_has_flags & SCRHAS_ENEMY) |
| 17141 | { | ||
| 17142 |
2/2✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 272 times.
|
2992 | for(int32_t k=0; k<10; k++) |
| 17143 | { | ||
| 17144 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2720 times.
|
2720 | if(!p_igetw(&(temp_mapscr->enemy[k]),f,true)) |
| 17145 | ✗ | return qe_invalid; | |
| 17146 |
1/2✓ Branch 0 taken 2720 times.
✗ Branch 1 not taken.
|
2720 | if (unsigned(temp_mapscr->enemy[k]) > MAXGUYS) |
| 17147 | ✗ | temp_mapscr->enemy[k] = 0; | |
| 17148 | 2720 | } | |
| 17149 |
1/2✓ Branch 0 taken 272 times.
✗ Branch 1 not taken.
|
272 | if(!p_getc(&(temp_mapscr->pattern),f,true)) |
| 17150 | ✗ | return qe_invalid; | |
| 17151 | 272 | } | |
| 17152 |
2/2✓ Branch 0 taken 4447 times.
✓ Branch 1 taken 29 times.
|
4476 | if(scr_has_flags & SCRHAS_CARRY) |
| 17153 | { | ||
| 17154 |
1/2✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
|
29 | if(!p_igetw(&(temp_mapscr->noreset),f,true)) |
| 17155 | ✗ | return qe_invalid; | |
| 17156 |
1/2✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
|
29 | if(!p_igetw(&(temp_mapscr->nocarry),f,true)) |
| 17157 | ✗ | return qe_invalid; | |
| 17158 |
1/2✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
|
29 | if(!p_getc(&(temp_mapscr->nextmap),f,true)) |
| 17159 | ✗ | return qe_invalid; | |
| 17160 |
1/2✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
|
29 | if(!p_getc(&(temp_mapscr->nextscr),f,true)) |
| 17161 | ✗ | return qe_invalid; | |
| 17162 | 29 | } | |
| 17163 |
2/2✓ Branch 0 taken 4459 times.
✓ Branch 1 taken 17 times.
|
4476 | if(scr_has_flags & SCRHAS_SCRIPT) |
| 17164 | { | ||
| 17165 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&(temp_mapscr->script),f,true)) |
| 17166 | ✗ | return qe_invalid; | |
| 17167 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&(temp_mapscr->preloadscript),f,true)) |
| 17168 | ✗ | return qe_invalid; | |
| 17169 |
2/2✓ Branch 0 taken 136 times.
✓ Branch 1 taken 17 times.
|
153 | for ( int32_t q = 0; q < 8; q++ ) |
| 17170 | { | ||
| 17171 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 136 times.
|
136 | if(!p_igetl(&(temp_mapscr->screeninitd[q]),f,true)) |
| 17172 | ✗ | return qe_invalid; | |
| 17173 | 136 | } | |
| 17174 | 17 | } | |
| 17175 |
1/2✓ Branch 0 taken 4476 times.
✗ Branch 1 not taken.
|
4476 | if(scr_has_flags & SCRHAS_UNUSED) |
| 17176 | { | ||
| 17177 | ✗ | for ( int32_t q = 0; q < 10; q++ ) | |
| 17178 | { | ||
| 17179 | ✗ | if(!p_igetl(&(temp_mapscr->npcstrings[q]),f,true)) | |
| 17180 | ✗ | return qe_invalid; | |
| 17181 | } | ||
| 17182 | ✗ | for ( int32_t q = 0; q < 10; q++ ) | |
| 17183 | { | ||
| 17184 | ✗ | if(!p_igetw(&(temp_mapscr->new_items[q]),f,true)) | |
| 17185 | ✗ | return qe_invalid; | |
| 17186 | } | ||
| 17187 | ✗ | for ( int32_t q = 0; q < 10; q++ ) | |
| 17188 | { | ||
| 17189 | ✗ | if(!p_igetw(&(temp_mapscr->new_item_x[q]),f,true)) | |
| 17190 | ✗ | return qe_invalid; | |
| 17191 | } | ||
| 17192 | ✗ | for ( int32_t q = 0; q < 10; q++ ) | |
| 17193 | { | ||
| 17194 | ✗ | if(!p_igetw(&(temp_mapscr->new_item_y[q]),f,true)) | |
| 17195 | ✗ | return qe_invalid; | |
| 17196 | } | ||
| 17197 | } | ||
| 17198 |
2/2✓ Branch 0 taken 4205 times.
✓ Branch 1 taken 271 times.
|
4476 | if(scr_has_flags & SCRHAS_SECRETS) |
| 17199 | { | ||
| 17200 |
2/2✓ Branch 0 taken 34688 times.
✓ Branch 1 taken 271 times.
|
34959 | for(int32_t k=0; k<128; k++) |
| 17201 | { | ||
| 17202 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34688 times.
|
34688 | if(!p_igetw(&(temp_mapscr->secretcombo[k]),f,true)) |
| 17203 | ✗ | return qe_invalid; | |
| 17204 | 34688 | } | |
| 17205 |
2/2✓ Branch 0 taken 34688 times.
✓ Branch 1 taken 271 times.
|
34959 | for(int32_t k=0; k<128; k++) |
| 17206 | { | ||
| 17207 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34688 times.
|
34688 | if(!p_getc(&(temp_mapscr->secretcset[k]),f,true)) |
| 17208 | ✗ | return qe_invalid; | |
| 17209 | 34688 | } | |
| 17210 |
2/2✓ Branch 0 taken 34688 times.
✓ Branch 1 taken 271 times.
|
34959 | for(int32_t k=0; k<128; k++) |
| 17211 | { | ||
| 17212 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34688 times.
|
34688 | if(!p_getc(&(temp_mapscr->secretflag[k]),f,true)) |
| 17213 | ✗ | return qe_invalid; | |
| 17214 | 34688 | } | |
| 17215 | 271 | } | |
| 17216 |
2/2✓ Branch 0 taken 2523 times.
✓ Branch 1 taken 1953 times.
|
4476 | if(scr_has_flags & SCRHAS_COMBOFLAG) |
| 17217 | { | ||
| 17218 |
2/2✓ Branch 0 taken 343728 times.
✓ Branch 1 taken 1953 times.
|
345681 | for(int32_t k=0; k<176; ++k) |
| 17219 | { | ||
| 17220 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 343728 times.
|
343728 | if(!p_igetw(&(temp_mapscr->data[k]),f,true)) |
| 17221 | ✗ | return qe_invalid; | |
| 17222 | 343728 | } | |
| 17223 |
2/2✓ Branch 0 taken 343728 times.
✓ Branch 1 taken 1953 times.
|
345681 | for(int32_t k=0; k<176; ++k) |
| 17224 | { | ||
| 17225 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 343728 times.
|
343728 | if(!p_getc(&(temp_mapscr->sflag[k]),f,true)) |
| 17226 | ✗ | return qe_invalid; | |
| 17227 | 343728 | } | |
| 17228 |
2/2✓ Branch 0 taken 343728 times.
✓ Branch 1 taken 1953 times.
|
345681 | for(int32_t k=0; k<176; ++k) |
| 17229 | { | ||
| 17230 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 343728 times.
|
343728 | if(!p_getc(&(temp_mapscr->cset[k]),f,true)) |
| 17231 | ✗ | return qe_invalid; | |
| 17232 | 343728 | } | |
| 17233 | 1953 | } | |
| 17234 |
1/2✓ Branch 0 taken 4476 times.
✗ Branch 1 not taken.
|
4476 | if(scr_has_flags & SCRHAS_MISC) |
| 17235 | { | ||
| 17236 |
1/2✓ Branch 0 taken 4476 times.
✗ Branch 1 not taken.
|
4476 | if(!p_igetw(&(temp_mapscr->color),f,true)) |
| 17237 | ✗ | return qe_invalid; | |
| 17238 |
1/2✓ Branch 0 taken 4476 times.
✗ Branch 1 not taken.
|
4476 | if(!p_getc(&(temp_mapscr->csensitive),f,true)) |
| 17239 | ✗ | return qe_invalid; | |
| 17240 |
1/2✓ Branch 0 taken 4476 times.
✗ Branch 1 not taken.
|
4476 | if(!p_getc(&(temp_mapscr->oceansfx),f,true)) |
| 17241 | ✗ | return qe_invalid; | |
| 17242 |
1/2✓ Branch 0 taken 4476 times.
✗ Branch 1 not taken.
|
4476 | if(!p_getc(&(temp_mapscr->bosssfx),f,true)) |
| 17243 | ✗ | return qe_invalid; | |
| 17244 |
1/2✓ Branch 0 taken 4476 times.
✗ Branch 1 not taken.
|
4476 | if(!p_getc(&(temp_mapscr->secretsfx),f,true)) |
| 17245 | ✗ | return qe_invalid; | |
| 17246 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4476 times.
|
4476 | if(!p_getc(&(temp_mapscr->holdupsfx),f,true)) |
| 17247 | ✗ | return qe_invalid; | |
| 17248 |
1/2✓ Branch 0 taken 4476 times.
✗ Branch 1 not taken.
|
4476 | if(!p_igetw(&(temp_mapscr->timedwarptics),f,true)) |
| 17249 | ✗ | return qe_invalid; | |
| 17250 |
1/2✓ Branch 0 taken 4476 times.
✗ Branch 1 not taken.
|
4476 | if(!p_igetw(&(temp_mapscr->screen_midi),f,true)) |
| 17251 | ✗ | return qe_invalid; | |
| 17252 |
1/2✓ Branch 0 taken 4476 times.
✗ Branch 1 not taken.
|
4476 | if(!p_getc(&(temp_mapscr->lens_layer),f,true)) |
| 17253 | ✗ | return qe_invalid; | |
| 17254 | 4476 | } | |
| 17255 | else | ||
| 17256 | { | ||
| 17257 | ✗ | temp_mapscr->screen_midi = -1; | |
| 17258 | ✗ | temp_mapscr->csensitive = 1; | |
| 17259 | } | ||
| 17260 | //FFC | ||
| 17261 | 4476 | bool old_ff = version < 25; | |
| 17262 | 4476 | dword bits = 0; | |
| 17263 | 4476 | word numffc = 32; | |
| 17264 |
2/2✓ Branch 0 taken 55 times.
✓ Branch 1 taken 4421 times.
|
4476 | if(old_ff) |
| 17265 | { | ||
| 17266 |
1/2✓ Branch 0 taken 55 times.
✗ Branch 1 not taken.
|
55 | if(!p_igetl(&bits,f,true)) |
| 17267 | ✗ | return qe_invalid; | |
| 17268 | 55 | } | |
| 17269 | else | ||
| 17270 | { | ||
| 17271 |
1/2✓ Branch 0 taken 4421 times.
✗ Branch 1 not taken.
|
4421 | if(!p_igetw(&numffc,f,true)) |
| 17272 | ✗ | return qe_invalid; | |
| 17273 | } | ||
| 17274 | byte tempbyte; | ||
| 17275 | word tempw; | ||
| 17276 |
4/6✓ Branch 0 taken 7 times.
✓ Branch 1 taken 4469 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 7 times.
|
4476 | static ffcdata nil_ffc; |
| 17277 |
2/2✓ Branch 0 taken 4476 times.
✓ Branch 1 taken 6669 times.
|
11145 | for(word m = 0; m < numffc; ++m) |
| 17278 | { | ||
| 17279 |
1/2✓ Branch 0 taken 6669 times.
✗ Branch 1 not taken.
|
6669 | ffcdata& tempffc = (m < MAXFFCS) |
| 17280 | 6669 | ? temp_mapscr->ffcs[m] | |
| 17281 | : nil_ffc; //sanity | ||
| 17282 | 6669 | tempffc.clear(); | |
| 17283 |
3/4✓ Branch 0 taken 1760 times.
✓ Branch 1 taken 4909 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1760 times.
|
6669 | if(old_ff && !(bits & (1<<m))) continue; |
| 17284 | |||
| 17285 |
1/2✓ Branch 0 taken 4909 times.
✗ Branch 1 not taken.
|
4909 | if(!p_igetw(&tempw,f,true)) |
| 17286 | ✗ | return qe_invalid; | |
| 17287 |
3/4✓ Branch 0 taken 4909 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 431 times.
✓ Branch 3 taken 4478 times.
|
4909 | if(!old_ff && !tempw) //empty ffc, nothing more to load |
| 17288 | 4478 | continue; | |
| 17289 | 431 | tempffc.setData(tempw); | |
| 17290 | |||
| 17291 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 431 times.
|
431 | if(!p_getc(&(tempffc.cset),f,true)) |
| 17292 | ✗ | return qe_invalid; | |
| 17293 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 431 times.
|
431 | if(!p_igetw(&(tempffc.delay),f,true)) |
| 17294 | ✗ | return qe_invalid; | |
| 17295 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 431 times.
|
431 | if(!p_igetzf(&(tempffc.x),f,true)) |
| 17296 | ✗ | return qe_invalid; | |
| 17297 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 431 times.
|
431 | if(!p_igetzf(&(tempffc.y),f,true)) |
| 17298 | ✗ | return qe_invalid; | |
| 17299 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 431 times.
|
431 | if(!p_igetzf(&(tempffc.vx),f,true)) |
| 17300 | ✗ | return qe_invalid; | |
| 17301 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 431 times.
|
431 | if(!p_igetzf(&(tempffc.vy),f,true)) |
| 17302 | ✗ | return qe_invalid; | |
| 17303 |
1/2✓ Branch 0 taken 431 times.
✗ Branch 1 not taken.
|
431 | if(!p_igetzf(&(tempffc.ax),f,true)) |
| 17304 | ✗ | return qe_invalid; | |
| 17305 |
1/2✓ Branch 0 taken 431 times.
✗ Branch 1 not taken.
|
431 | if(!p_igetzf(&(tempffc.ay),f,true)) |
| 17306 | ✗ | return qe_invalid; | |
| 17307 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 431 times.
|
431 | if(!p_getc(&(tempffc.link),f,true)) |
| 17308 | ✗ | return qe_invalid; | |
| 17309 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 431 times.
|
431 | if(version < 24) |
| 17310 | { | ||
| 17311 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 17312 | ✗ | return qe_invalid; | |
| 17313 | ✗ | tempffc.hxsz = (tempbyte&0x3F)+1; | |
| 17314 | ✗ | tempffc.txsz = (tempbyte>>6)+1; | |
| 17315 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 17316 | ✗ | return qe_invalid; | |
| 17317 | ✗ | tempffc.hysz = (tempbyte&0x3F)+1; | |
| 17318 | ✗ | tempffc.tysz = (tempbyte>>6)+1; | |
| 17319 | } | ||
| 17320 | else | ||
| 17321 | { | ||
| 17322 |
1/2✓ Branch 0 taken 431 times.
✗ Branch 1 not taken.
|
431 | if(!p_igetl(&(tempffc.hxsz),f,true)) |
| 17323 | ✗ | return qe_invalid; | |
| 17324 |
1/2✓ Branch 0 taken 431 times.
✗ Branch 1 not taken.
|
431 | if(!p_igetl(&(tempffc.hysz),f,true)) |
| 17325 | ✗ | return qe_invalid; | |
| 17326 |
1/2✓ Branch 0 taken 431 times.
✗ Branch 1 not taken.
|
431 | if(!p_getc(&(tempffc.txsz),f,true)) |
| 17327 | ✗ | return qe_invalid; | |
| 17328 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 431 times.
|
431 | if(!p_getc(&(tempffc.tysz),f,true)) |
| 17329 | ✗ | return qe_invalid; | |
| 17330 | } | ||
| 17331 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 431 times.
|
431 | if(!p_igetl(&(tempffc.flags),f,true)) |
| 17332 | ✗ | return qe_invalid; | |
| 17333 | 431 | tempffc.updateSolid(); | |
| 17334 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 431 times.
|
431 | if(!p_igetw(&(tempffc.script),f,true)) |
| 17335 | ✗ | return qe_invalid; | |
| 17336 |
2/2✓ Branch 0 taken 3448 times.
✓ Branch 1 taken 431 times.
|
3879 | for(auto q = 0; q < 8; ++q) |
| 17337 | { | ||
| 17338 |
1/2✓ Branch 0 taken 3448 times.
✗ Branch 1 not taken.
|
3448 | if(!p_igetl(&(tempffc.initd[q]),f,true)) |
| 17339 | ✗ | return qe_invalid; | |
| 17340 | 3448 | } | |
| 17341 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 431 times.
|
431 | if(!p_getc(&(tempbyte),f,true)) |
| 17342 | ✗ | return qe_invalid; | |
| 17343 | 431 | tempffc.inita[0]=tempbyte*10000; | |
| 17344 | |||
| 17345 |
1/2✓ Branch 0 taken 431 times.
✗ Branch 1 not taken.
|
431 | if(!p_getc(&(tempbyte),f,true)) |
| 17346 | ✗ | return qe_invalid; | |
| 17347 | 431 | tempffc.inita[1]=tempbyte*10000; | |
| 17348 | |||
| 17349 | 431 | tempffc.initialized = false; | |
| 17350 | 431 | } | |
| 17351 |
2/2✓ Branch 0 taken 566259 times.
✓ Branch 1 taken 4476 times.
|
570735 | for(word m = numffc; m < MAXFFCS; ++m) |
| 17352 | { | ||
| 17353 | 566259 | temp_mapscr->ffcs[m].clear(); | |
| 17354 | 566259 | } | |
| 17355 | 4476 | temp_mapscr->update_ffc_count(numffc-1); | |
| 17356 | //END FFC | ||
| 17357 | } | ||
| 17358 | 122524 | return 0; | |
| 17359 | 126208 | } | |
| 17360 | |||
| 17361 | |||
| 17362 | 77 | int32_t readmaps(PACKFILE *f, zquestheader *Header, bool keepdata) | |
| 17363 | { | ||
| 17364 | 77 | int32_t scr=0; | |
| 17365 | |||
| 17366 | 77 | word version=0; | |
| 17367 | dword dummy; | ||
| 17368 | int32_t screens_to_read; | ||
| 17369 | |||
| 17370 | 77 | mapscr temp_mapscr; | |
| 17371 | zcmap temp_map; | ||
| 17372 | word temp_map_count; | ||
| 17373 | dword section_size; | ||
| 17374 | |||
| 17375 |
2/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 17376 | { | ||
| 17377 | ✗ | screens_to_read=MAPSCRS192b136; | |
| 17378 | } | ||
| 17379 | else | ||
| 17380 | { | ||
| 17381 | 77 | screens_to_read=MAPSCRS; | |
| 17382 | } | ||
| 17383 | |||
| 17384 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(Header->zelda_version > 0x192) |
| 17385 | { | ||
| 17386 | //section version info | ||
| 17387 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&version,f,true)) |
| 17388 | { | ||
| 17389 | ✗ | return qe_invalid; | |
| 17390 | } | ||
| 17391 | |||
| 17392 | 77 | FFCore.quest_format[vMaps] = version; | |
| 17393 | |||
| 17394 | //al_trace("Maps version %d\n", version); | ||
| 17395 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&dummy,f,true)) |
| 17396 | { | ||
| 17397 | ✗ | return qe_invalid; | |
| 17398 | } | ||
| 17399 | |||
| 17400 | //section size | ||
| 17401 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetl(§ion_size,f,true)) |
| 17402 | { | ||
| 17403 | ✗ | return qe_invalid; | |
| 17404 | } | ||
| 17405 | |||
| 17406 | //finally... section data | ||
| 17407 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&temp_map_count,f,true)) |
| 17408 | { | ||
| 17409 | ✗ | return 5; | |
| 17410 | } | ||
| 17411 | 77 | } | |
| 17412 | else | ||
| 17413 | { | ||
| 17414 | ✗ | temp_map_count=map_count; | |
| 17415 | } | ||
| 17416 | |||
| 17417 | |||
| 17418 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(keepdata) |
| 17419 | { | ||
| 17420 | 77 | const int32_t _mapsSize = MAPSCRS*temp_map_count; | |
| 17421 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | TheMaps.resize(_mapsSize); |
| 17422 | |||
| 17423 |
2/2✓ Branch 0 taken 126480 times.
✓ Branch 1 taken 77 times.
|
126557 | for(int32_t i(0); i<_mapsSize; i++) |
| 17424 |
1/2✓ Branch 0 taken 126480 times.
✗ Branch 1 not taken.
|
126480 | TheMaps[i].zero_memory(); |
| 17425 | |||
| 17426 | // Used to be done for each screen | ||
| 17427 |
2/2✓ Branch 0 taken 9856 times.
✓ Branch 1 taken 77 times.
|
9933 | for(int32_t i=0; i<MAXFFCS; i++) |
| 17428 | { | ||
| 17429 | 9856 | ffcScriptData[i].a[0] = 10000; | |
| 17430 | 9856 | ffcScriptData[i].a[1] = 10000; | |
| 17431 | 9856 | } | |
| 17432 | |||
| 17433 | 77 | memset(ZCMaps, 0, sizeof(zcmap)*MAXMAPS2); | |
| 17434 | 77 | } | |
| 17435 | |||
| 17436 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | temp_mapscr.zero_memory(); |
| 17437 | |||
| 17438 | 77 | memset(&temp_map, 0, sizeof(zcmap)); | |
| 17439 | 77 | temp_map.scrResWidth = 256; | |
| 17440 | 77 | temp_map.scrResHeight = 224; | |
| 17441 | 77 | temp_map.tileWidth = 16; | |
| 17442 | 77 | temp_map.tileHeight = 11; | |
| 17443 | 77 | temp_map.viewWidth = 256; | |
| 17444 | 77 | temp_map.viewHeight = 176; | |
| 17445 | 77 | temp_map.viewX = 0; | |
| 17446 | 77 | temp_map.viewY = 64; | |
| 17447 | 77 | temp_map.subaWidth = 256; | |
| 17448 | 77 | temp_map.subaHeight = 168; | |
| 17449 | 77 | temp_map.subaTrans = false; | |
| 17450 | 77 | temp_map.subpWidth = 256; | |
| 17451 | 77 | temp_map.subpHeight = 56; | |
| 17452 | 77 | temp_map.subpTrans = false; | |
| 17453 |
4/4✓ Branch 0 taken 77 times.
✓ Branch 1 taken 930 times.
✓ Branch 2 taken 77 times.
✓ Branch 3 taken 930 times.
|
1007 | for(int32_t i=0; i<temp_map_count && i<MAXMAPS2; i++) |
| 17454 | { | ||
| 17455 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 930 times.
|
930 | if(keepdata==true) //!TODO Trim fully |
| 17456 | { | ||
| 17457 | 930 | memcpy(&ZCMaps[i], &temp_map, sizeof(zcmap)); | |
| 17458 | 930 | } | |
| 17459 | 930 | byte valid=1; | |
| 17460 |
2/2✓ Branch 0 taken 62 times.
✓ Branch 1 taken 868 times.
|
930 | if(version > 22) |
| 17461 | { | ||
| 17462 |
2/4✓ Branch 0 taken 62 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 62 times.
✗ Branch 3 not taken.
|
62 | if(!p_getc(&valid,f,true)) |
| 17463 | ✗ | return qe_invalid; | |
| 17464 | 62 | } | |
| 17465 |
2/2✓ Branch 0 taken 126480 times.
✓ Branch 1 taken 930 times.
|
127410 | for(int32_t j=0; j<screens_to_read; j++) |
| 17466 | { | ||
| 17467 | 126480 | scr=i*MAPSCRS+j; | |
| 17468 |
1/2✓ Branch 0 taken 126480 times.
✗ Branch 1 not taken.
|
126480 | clear_screen(&temp_mapscr); |
| 17469 |
2/2✓ Branch 0 taken 126208 times.
✓ Branch 1 taken 272 times.
|
126480 | if(valid) |
| 17470 |
1/2✓ Branch 0 taken 126208 times.
✗ Branch 1 not taken.
|
126208 | readmapscreen(f, Header, &temp_mapscr, &temp_map, version); |
| 17471 | |||
| 17472 |
1/2✓ Branch 0 taken 126480 times.
✗ Branch 1 not taken.
|
126480 | if(keepdata==true) |
| 17473 | { | ||
| 17474 |
1/2✓ Branch 0 taken 126480 times.
✗ Branch 1 not taken.
|
126480 | TheMaps[scr] = temp_mapscr; |
| 17475 | 126480 | } | |
| 17476 | 126480 | } | |
| 17477 | |||
| 17478 |
1/2✓ Branch 0 taken 930 times.
✗ Branch 1 not taken.
|
930 | if(keepdata==true) |
| 17479 | { | ||
| 17480 |
2/6✓ Branch 0 taken 930 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 930 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
930 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 17481 | { | ||
| 17482 | ✗ | int32_t index = (i*MAPSCRS+132); | |
| 17483 | |||
| 17484 | ✗ | TheMaps[index]=TheMaps[index-1]; | |
| 17485 | |||
| 17486 | ✗ | MEMCPY_ARR(TheMaps[i*MAPSCRS+132].data, TheMaps[i*MAPSCRS+131].data); | |
| 17487 | ✗ | MEMCPY_ARR(TheMaps[i*MAPSCRS+132].sflag, TheMaps[i*MAPSCRS+131].sflag); | |
| 17488 | ✗ | MEMCPY_ARR(TheMaps[i*MAPSCRS+132].cset, TheMaps[i*MAPSCRS+131].cset); | |
| 17489 | |||
| 17490 | ✗ | for(int32_t j=133; j<MAPSCRS; j++) | |
| 17491 | { | ||
| 17492 | ✗ | scr=i*MAPSCRS+j; | |
| 17493 | |||
| 17494 | ✗ | TheMaps[scr].zero_memory(); | |
| 17495 | ✗ | TheMaps[scr].valid = mVERSION; | |
| 17496 | ✗ | TheMaps[scr].screen_midi = -1; | |
| 17497 | ✗ | TheMaps[scr].csensitive = 1; | |
| 17498 | } | ||
| 17499 | } | ||
| 17500 | |||
| 17501 |
2/6✓ Branch 0 taken 930 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 930 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
930 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 17502 | { | ||
| 17503 | ✗ | for(int32_t j=0; j<MAPSCRS; j++) | |
| 17504 | { | ||
| 17505 | ✗ | scr=i*MAPSCRS+j; | |
| 17506 | ✗ | TheMaps[scr].door_combo_set=MakeDoors(i, j); | |
| 17507 | |||
| 17508 | ✗ | for(int32_t k=0; k<128; k++) | |
| 17509 | { | ||
| 17510 | ✗ | TheMaps[scr].secretcset[k]=tcmbcset2(i, TheMaps[scr].secretcombo[k]); | |
| 17511 | ✗ | TheMaps[scr].secretflag[k]=tcmbflag2(i, TheMaps[scr].secretcombo[k]); | |
| 17512 | ✗ | TheMaps[scr].secretcombo[k]=tcmbdat2(i, j, TheMaps[scr].secretcombo[k]); | |
| 17513 | } | ||
| 17514 | } | ||
| 17515 | } | ||
| 17516 | 930 | } | |
| 17517 | 930 | } | |
| 17518 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata) |
| 17519 | { | ||
| 17520 | 77 | map_count = temp_map_count; | |
| 17521 | 77 | } | |
| 17522 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | clear_screen(&temp_mapscr); |
| 17523 | 77 | return 0; | |
| 17524 | 77 | } | |
| 17525 | |||
| 17526 | |||
| 17527 | 70 | int32_t readcombos_old(word section_version, PACKFILE *f, zquestheader *, word version, word build, word start_combo, word max_combos, bool keepdata) | |
| 17528 | { | ||
| 17529 | 70 | reset_combo_animations(); | |
| 17530 | 70 | reset_combo_animations2(); | |
| 17531 | |||
| 17532 | 70 | init_combo_classes(); | |
| 17533 | |||
| 17534 | // combos | ||
| 17535 | 70 | word combos_used=0; | |
| 17536 | int32_t dummy; | ||
| 17537 | byte padding; | ||
| 17538 | 70 | newcombo temp_combo; | |
| 17539 | //word section_cversion=0; | ||
| 17540 | |||
| 17541 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 70 times.
|
70 | if(keepdata==true) |
| 17542 | { | ||
| 17543 |
2/2✓ Branch 0 taken 4569600 times.
✓ Branch 1 taken 70 times.
|
4569670 | for(int32_t q = start_combo; q < start_combo+max_combos; ++q) |
| 17544 | 4569600 | combobuf[q].clear(); | |
| 17545 | 70 | } | |
| 17546 | |||
| 17547 | // if(version > 0x192) | ||
| 17548 | // { | ||
| 17549 | // //section version info | ||
| 17550 | // if(!p_igetw(§ion_version,f,true)) | ||
| 17551 | // { | ||
| 17552 | // return qe_invalid; | ||
| 17553 | // } | ||
| 17554 | |||
| 17555 | // FFCore.quest_format[vCombos] = section_version; | ||
| 17556 | |||
| 17557 | // //al_trace("Combos version %d\n", section_version); | ||
| 17558 | // if(!p_igetw(§ion_cversion,f,true)) | ||
| 17559 | // { | ||
| 17560 | // return qe_invalid; | ||
| 17561 | // } | ||
| 17562 | |||
| 17563 | // //section size | ||
| 17564 | // if(!p_igetl(&dummy,f,true)) | ||
| 17565 | // { | ||
| 17566 | // return qe_invalid; | ||
| 17567 | // } | ||
| 17568 | // } | ||
| 17569 | |||
| 17570 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 70 times.
|
70 | if(version < 0x174) |
| 17571 | { | ||
| 17572 | ✗ | combos_used=1024; | |
| 17573 | } | ||
| 17574 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 70 times.
|
70 | else if(version < 0x191) |
| 17575 | { | ||
| 17576 | ✗ | combos_used=2048; | |
| 17577 | } | ||
| 17578 | else | ||
| 17579 | { | ||
| 17580 |
1/2✓ Branch 0 taken 70 times.
✗ Branch 1 not taken.
|
70 | if(!p_igetw(&combos_used,f,true)) |
| 17581 | { | ||
| 17582 | ✗ | return qe_invalid; | |
| 17583 | } | ||
| 17584 | } | ||
| 17585 | |||
| 17586 | //finally... section data | ||
| 17587 |
2/2✓ Branch 0 taken 268584 times.
✓ Branch 1 taken 70 times.
|
268654 | for(int32_t i=0; i<combos_used; i++) |
| 17588 | { | ||
| 17589 | 268584 | temp_combo.clear(); | |
| 17590 | |||
| 17591 |
2/2✓ Branch 0 taken 65200 times.
✓ Branch 1 taken 203384 times.
|
268584 | if ( section_version >= 11 ) |
| 17592 | { | ||
| 17593 |
1/2✓ Branch 0 taken 65200 times.
✗ Branch 1 not taken.
|
65200 | if(!p_igetl(&temp_combo.tile,f,true)) |
| 17594 | { | ||
| 17595 | ✗ | return qe_invalid; | |
| 17596 | } | ||
| 17597 | 65200 | } | |
| 17598 | else | ||
| 17599 | { | ||
| 17600 |
1/2✓ Branch 0 taken 203384 times.
✗ Branch 1 not taken.
|
203384 | if(!p_igetw(&temp_combo.tile,f,true)) |
| 17601 | { | ||
| 17602 | ✗ | return qe_invalid; | |
| 17603 | } | ||
| 17604 | } | ||
| 17605 | 268584 | temp_combo.o_tile = temp_combo.tile; | |
| 17606 |
1/2✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
|
268584 | if(!p_getc(&temp_combo.flip,f,true)) |
| 17607 | { | ||
| 17608 | ✗ | return qe_invalid; | |
| 17609 | } | ||
| 17610 | |||
| 17611 |
1/2✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
|
268584 | if(!p_getc(&temp_combo.walk,f,true)) |
| 17612 | { | ||
| 17613 | ✗ | return qe_invalid; | |
| 17614 | } | ||
| 17615 | |||
| 17616 |
1/2✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
|
268584 | if(!p_getc(&temp_combo.type,f,true)) |
| 17617 | { | ||
| 17618 | ✗ | return qe_invalid; | |
| 17619 | } | ||
| 17620 | |||
| 17621 |
1/2✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
|
268584 | if(!p_getc(&temp_combo.csets,f,true)) |
| 17622 | { | ||
| 17623 | ✗ | return qe_invalid; | |
| 17624 | } | ||
| 17625 | |||
| 17626 |
1/2✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
|
268584 | if(version < 0x193) |
| 17627 | { | ||
| 17628 | ✗ | if(!p_getc(&padding,f,true)) | |
| 17629 | { | ||
| 17630 | ✗ | return qe_invalid; | |
| 17631 | } | ||
| 17632 | |||
| 17633 | ✗ | if(!p_getc(&padding,f,true)) | |
| 17634 | { | ||
| 17635 | ✗ | return qe_invalid; | |
| 17636 | } | ||
| 17637 | |||
| 17638 | ✗ | if(version < 0x192) | |
| 17639 | { | ||
| 17640 | ✗ | if(version == 0x191) | |
| 17641 | { | ||
| 17642 | ✗ | for(int32_t tmpcounter=0; tmpcounter<16; tmpcounter++) | |
| 17643 | { | ||
| 17644 | ✗ | if(!p_getc(&padding,f,true)) | |
| 17645 | { | ||
| 17646 | ✗ | return qe_invalid; | |
| 17647 | } | ||
| 17648 | } | ||
| 17649 | } | ||
| 17650 | |||
| 17651 | ✗ | if(keepdata==true) | |
| 17652 | { | ||
| 17653 | ✗ | memcpy(&combobuf[i], &temp_combo, sizeof(temp_combo)); | |
| 17654 | } | ||
| 17655 | |||
| 17656 | ✗ | continue; | |
| 17657 | } | ||
| 17658 | } | ||
| 17659 | |||
| 17660 |
1/2✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
|
268584 | if(!p_getc(&temp_combo.frames,f,true)) |
| 17661 | { | ||
| 17662 | ✗ | return qe_invalid; | |
| 17663 | } | ||
| 17664 | |||
| 17665 |
1/2✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
|
268584 | if(!p_getc(&temp_combo.speed,f,true)) |
| 17666 | { | ||
| 17667 | ✗ | return qe_invalid; | |
| 17668 | } | ||
| 17669 | |||
| 17670 |
1/2✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
|
268584 | if(!p_igetw(&temp_combo.nextcombo,f,true)) |
| 17671 | { | ||
| 17672 | ✗ | return qe_invalid; | |
| 17673 | } | ||
| 17674 | |||
| 17675 |
1/2✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
|
268584 | if(!p_getc(&temp_combo.nextcset,f,true)) |
| 17676 | { | ||
| 17677 | ✗ | return qe_invalid; | |
| 17678 | } | ||
| 17679 | |||
| 17680 | //Base flag | ||
| 17681 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 268584 times.
|
268584 | if(section_version>=3) |
| 17682 | { | ||
| 17683 |
1/2✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
|
268584 | if(!p_getc(&temp_combo.flag,f,true)) |
| 17684 | { | ||
| 17685 | ✗ | return qe_invalid; | |
| 17686 | } | ||
| 17687 | 268584 | } | |
| 17688 | |||
| 17689 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 268584 times.
|
268584 | if(section_version>=4) |
| 17690 | { | ||
| 17691 |
1/2✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
|
268584 | if(!p_getc(&temp_combo.skipanim,f,true)) |
| 17692 | { | ||
| 17693 | ✗ | return qe_invalid; | |
| 17694 | } | ||
| 17695 | |||
| 17696 |
1/2✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
|
268584 | if(!p_igetw(&temp_combo.nexttimer,f,true)) |
| 17697 | { | ||
| 17698 | ✗ | return qe_invalid; | |
| 17699 | } | ||
| 17700 | 268584 | } | |
| 17701 | |||
| 17702 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 268584 times.
|
268584 | if(section_version>=5) |
| 17703 | { | ||
| 17704 |
1/2✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
|
268584 | if(!p_getc(&temp_combo.skipanimy,f,true)) |
| 17705 | { | ||
| 17706 | ✗ | return qe_invalid; | |
| 17707 | } | ||
| 17708 | 268584 | } | |
| 17709 | |||
| 17710 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 268584 times.
|
268584 | if(section_version>=6) |
| 17711 | { | ||
| 17712 |
1/2✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
|
268584 | if(!p_getc(&temp_combo.animflags,f,true)) |
| 17713 | { | ||
| 17714 | ✗ | return qe_invalid; | |
| 17715 | } | ||
| 17716 | |||
| 17717 |
1/2✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
|
268584 | if(section_version == 6) |
| 17718 | ✗ | temp_combo.animflags = temp_combo.animflags ? AF_FRESH : 0; | |
| 17719 | 268584 | } | |
| 17720 | |||
| 17721 |
2/2✓ Branch 0 taken 203384 times.
✓ Branch 1 taken 65200 times.
|
268584 | if(section_version>=8) //combo Attributes[4] and userflags. |
| 17722 | { | ||
| 17723 |
2/2✓ Branch 0 taken 260800 times.
✓ Branch 1 taken 65200 times.
|
326000 | for ( int32_t q = 0; q < NUM_COMBO_ATTRIBUTES; q++ ) |
| 17724 | { | ||
| 17725 |
1/2✓ Branch 0 taken 260800 times.
✗ Branch 1 not taken.
|
260800 | if(!p_igetl(&temp_combo.attributes[q],f,true)) |
| 17726 | { | ||
| 17727 | ✗ | return qe_invalid; | |
| 17728 | } | ||
| 17729 | 260800 | } | |
| 17730 |
1/2✓ Branch 0 taken 65200 times.
✗ Branch 1 not taken.
|
65200 | if(!p_igetl(&temp_combo.usrflags,f,true)) |
| 17731 | { | ||
| 17732 | ✗ | return qe_invalid; | |
| 17733 | } | ||
| 17734 |
1/2✓ Branch 0 taken 65200 times.
✗ Branch 1 not taken.
|
65200 | if(section_version >= 20) |
| 17735 | { | ||
| 17736 |
1/2✓ Branch 0 taken 65200 times.
✗ Branch 1 not taken.
|
65200 | if(!p_igetw(&temp_combo.genflags,f,true)) |
| 17737 | { | ||
| 17738 | ✗ | return qe_invalid; | |
| 17739 | } | ||
| 17740 | 65200 | } | |
| 17741 | else | ||
| 17742 | { | ||
| 17743 | ✗ | temp_combo.genflags = 0; | |
| 17744 | ✗ | switch(temp_combo.type) | |
| 17745 | { | ||
| 17746 | case cPUSH_WAIT: case cPUSH_HEAVY: | ||
| 17747 | case cPUSH_HW: case cL_STATUE: | ||
| 17748 | case cR_STATUE: case cPUSH_HEAVY2: | ||
| 17749 | case cPUSH_HW2: case cPOUND: | ||
| 17750 | case cC_STATUE: case cMIRROR: | ||
| 17751 | case cMIRRORSLASH: case cMIRRORBACKSLASH: | ||
| 17752 | case cMAGICPRISM: case cMAGICPRISM4: | ||
| 17753 | case cMAGICSPONGE: case cEYEBALL_A: | ||
| 17754 | case cEYEBALL_B: case cEYEBALL_4: | ||
| 17755 | case cBUSH: case cFLOWERS: | ||
| 17756 | case cLOCKBLOCK: case cLOCKBLOCK2: | ||
| 17757 | case cBOSSLOCKBLOCK: case cBOSSLOCKBLOCK2: | ||
| 17758 | case cCHEST: case cCHEST2: | ||
| 17759 | case cLOCKEDCHEST: case cLOCKEDCHEST2: | ||
| 17760 | case cBOSSCHEST: case cBOSSCHEST2: | ||
| 17761 | case cBUSHNEXT: case cBUSHTOUCHY: | ||
| 17762 | case cFLOWERSTOUCHY: case cBUSHNEXTTOUCHY: | ||
| 17763 | case cSIGNPOST: case cCSWITCHBLOCK: | ||
| 17764 | case cTORCH: case cTRIGGERGENERIC: | ||
| 17765 | ✗ | if(temp_combo.usrflags & cflag16) | |
| 17766 | { | ||
| 17767 | ✗ | temp_combo.genflags |= cflag1; | |
| 17768 | ✗ | temp_combo.usrflags &= ~cflag16; | |
| 17769 | } | ||
| 17770 | ✗ | break; } | |
| 17771 | } | ||
| 17772 | 65200 | } | |
| 17773 |
2/2✓ Branch 0 taken 65200 times.
✓ Branch 1 taken 203384 times.
|
268584 | if(section_version>=10) //combo trigger flags |
| 17774 | { | ||
| 17775 |
2/2✓ Branch 0 taken 195600 times.
✓ Branch 1 taken 65200 times.
|
260800 | for ( int32_t q = 0; q < 3; q++ ) |
| 17776 | { | ||
| 17777 |
1/2✓ Branch 0 taken 195600 times.
✗ Branch 1 not taken.
|
195600 | if(!p_igetl(&temp_combo.triggerflags[q],f,true)) |
| 17778 | { | ||
| 17779 | ✗ | return qe_invalid; | |
| 17780 | } | ||
| 17781 | 195600 | } | |
| 17782 | 65200 | } | |
| 17783 |
1/2✓ Branch 0 taken 203384 times.
✗ Branch 1 not taken.
|
203384 | else if(section_version==9) //combo trigger flags, V9 only had two indices of triggerflags[] |
| 17784 | { | ||
| 17785 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 17786 | { | ||
| 17787 | ✗ | if(!p_igetl(&temp_combo.triggerflags[q],f,true)) | |
| 17788 | { | ||
| 17789 | ✗ | return qe_invalid; | |
| 17790 | } | ||
| 17791 | } | ||
| 17792 | } | ||
| 17793 |
2/2✓ Branch 0 taken 203384 times.
✓ Branch 1 taken 65200 times.
|
268584 | if(section_version >= 9) |
| 17794 | { | ||
| 17795 |
1/2✓ Branch 0 taken 65200 times.
✗ Branch 1 not taken.
|
65200 | if(!p_igetl(&temp_combo.triggerlevel,f,true)) |
| 17796 | { | ||
| 17797 | ✗ | return qe_invalid; | |
| 17798 | } | ||
| 17799 | 65200 | } | |
| 17800 |
2/2✓ Branch 0 taken 203384 times.
✓ Branch 1 taken 65200 times.
|
268584 | if(section_version >= 22) |
| 17801 | { | ||
| 17802 |
1/2✓ Branch 0 taken 65200 times.
✗ Branch 1 not taken.
|
65200 | if(!p_getc(&temp_combo.triggerbtn,f,true)) |
| 17803 | { | ||
| 17804 | ✗ | return qe_invalid; | |
| 17805 | } | ||
| 17806 | 65200 | } | |
| 17807 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 268584 times.
|
268584 | if(section_version < 23) |
| 17808 | { | ||
| 17809 |
2/2✓ Branch 0 taken 27 times.
✓ Branch 1 taken 268557 times.
|
268584 | switch(temp_combo.type) //combotriggerCMBTYPEFX now required for combotype-specific effects |
| 17810 | { | ||
| 17811 | case cSCRIPT1: case cSCRIPT2: case cSCRIPT3: case cSCRIPT4: case cSCRIPT5: | ||
| 17812 | case cSCRIPT6: case cSCRIPT7: case cSCRIPT8: case cSCRIPT9: case cSCRIPT10: | ||
| 17813 | case cTRIGGERGENERIC: case cCSWITCH: | ||
| 17814 | 27 | temp_combo.triggerflags[0] |= combotriggerCMBTYPEFX; | |
| 17815 | 27 | } | |
| 17816 | 268584 | } | |
| 17817 |
1/2✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
|
268584 | if(section_version >= 24) |
| 17818 | { | ||
| 17819 | ✗ | if(!p_getc(&temp_combo.triggeritem,f,true)) | |
| 17820 | { | ||
| 17821 | ✗ | return qe_invalid; | |
| 17822 | } | ||
| 17823 | ✗ | if(!p_getc(&temp_combo.trigtimer,f,true)) | |
| 17824 | { | ||
| 17825 | ✗ | return qe_invalid; | |
| 17826 | } | ||
| 17827 | } | ||
| 17828 |
1/2✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
|
268584 | if(section_version >= 25) |
| 17829 | { | ||
| 17830 | ✗ | if(!p_getc(&temp_combo.trigsfx,f,true)) | |
| 17831 | { | ||
| 17832 | ✗ | return qe_invalid; | |
| 17833 | } | ||
| 17834 | } | ||
| 17835 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 268584 times.
|
268584 | if(section_version >= 27) |
| 17836 | { | ||
| 17837 | ✗ | if(!p_igetl(&temp_combo.trigchange,f,true)) | |
| 17838 | { | ||
| 17839 | ✗ | return qe_invalid; | |
| 17840 | } | ||
| 17841 | } | ||
| 17842 | else | ||
| 17843 | { | ||
| 17844 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 268584 times.
|
268584 | if(temp_combo.triggerflags[0] & 0x00040000) //'next' |
| 17845 | ✗ | temp_combo.trigchange = 1; | |
| 17846 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 268584 times.
|
268584 | else if(temp_combo.triggerflags[0] & 0x00080000) //'prev' |
| 17847 | ✗ | temp_combo.trigchange = -1; | |
| 17848 | 268584 | else temp_combo.trigchange = 0; | |
| 17849 | 268584 | temp_combo.triggerflags[0] &= ~(0x00040000|0x00080000); | |
| 17850 | } | ||
| 17851 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 268584 times.
|
268584 | if(section_version >= 29) |
| 17852 | { | ||
| 17853 | ✗ | if(!p_igetw(&temp_combo.trigprox,f,true)) | |
| 17854 | { | ||
| 17855 | ✗ | return qe_invalid; | |
| 17856 | } | ||
| 17857 | ✗ | if(!p_getc(&temp_combo.trigctr,f,true)) | |
| 17858 | { | ||
| 17859 | ✗ | return qe_invalid; | |
| 17860 | } | ||
| 17861 | ✗ | if(!p_igetl(&temp_combo.trigctramnt,f,true)) | |
| 17862 | { | ||
| 17863 | ✗ | return qe_invalid; | |
| 17864 | } | ||
| 17865 | } | ||
| 17866 | else | ||
| 17867 | { | ||
| 17868 | 268584 | temp_combo.trigprox = 0; | |
| 17869 | 268584 | temp_combo.trigctr = 0; | |
| 17870 | 268584 | temp_combo.trigctramnt = 0; | |
| 17871 | } | ||
| 17872 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 268584 times.
|
268584 | if(section_version >= 30) |
| 17873 | { | ||
| 17874 | ✗ | if(!p_getc(&temp_combo.triglbeam,f,true)) | |
| 17875 | { | ||
| 17876 | ✗ | return qe_invalid; | |
| 17877 | } | ||
| 17878 | } | ||
| 17879 | 268584 | else temp_combo.triglbeam = 0; | |
| 17880 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 268584 times.
|
268584 | if(section_version >= 31) |
| 17881 | { | ||
| 17882 | ✗ | if(!p_getc(&temp_combo.trigcschange,f,true)) | |
| 17883 | { | ||
| 17884 | ✗ | return qe_invalid; | |
| 17885 | } | ||
| 17886 | ✗ | if(!p_igetw(&temp_combo.spawnitem,f,true)) | |
| 17887 | { | ||
| 17888 | ✗ | return qe_invalid; | |
| 17889 | } | ||
| 17890 | ✗ | if(!p_igetw(&temp_combo.spawnenemy,f,true)) | |
| 17891 | { | ||
| 17892 | ✗ | return qe_invalid; | |
| 17893 | } | ||
| 17894 | ✗ | if(!p_getc(&temp_combo.exstate,f,true)) | |
| 17895 | { | ||
| 17896 | ✗ | return qe_invalid; | |
| 17897 | } | ||
| 17898 | ✗ | if(!p_igetl(&temp_combo.spawnip,f,true)) | |
| 17899 | { | ||
| 17900 | ✗ | return qe_invalid; | |
| 17901 | } | ||
| 17902 | ✗ | if(!p_getc(&temp_combo.trigcopycat,f,true)) | |
| 17903 | { | ||
| 17904 | ✗ | return qe_invalid; | |
| 17905 | } | ||
| 17906 | } | ||
| 17907 | else | ||
| 17908 | { | ||
| 17909 | 268584 | temp_combo.trigcschange = 0; | |
| 17910 | 268584 | temp_combo.spawnitem = 0; | |
| 17911 | 268584 | temp_combo.spawnenemy = 0; | |
| 17912 | 268584 | temp_combo.exstate = -1; | |
| 17913 | 268584 | temp_combo.spawnip = 0; | |
| 17914 | 268584 | temp_combo.trigcopycat = 0; | |
| 17915 | } | ||
| 17916 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 268584 times.
|
268584 | if(section_version >= 32) |
| 17917 | { | ||
| 17918 | ✗ | if(!p_getc(&temp_combo.trigcooldown,f,true)) | |
| 17919 | { | ||
| 17920 | ✗ | return qe_invalid; | |
| 17921 | } | ||
| 17922 | } | ||
| 17923 | else | ||
| 17924 | { | ||
| 17925 | 268584 | temp_combo.trigcooldown = 0; | |
| 17926 | } | ||
| 17927 | |||
| 17928 |
2/2✓ Branch 0 taken 203384 times.
✓ Branch 1 taken 65200 times.
|
268584 | if(section_version>=12) //combo label |
| 17929 | { | ||
| 17930 |
2/2✓ Branch 0 taken 717200 times.
✓ Branch 1 taken 65200 times.
|
782400 | for ( int32_t q = 0; q < 11; q++ ) |
| 17931 | { | ||
| 17932 |
1/2✓ Branch 0 taken 717200 times.
✗ Branch 1 not taken.
|
717200 | if(!p_getc(&temp_combo.label[q],f,true)) |
| 17933 | { | ||
| 17934 | ✗ | return qe_invalid; | |
| 17935 | } | ||
| 17936 | 717200 | } | |
| 17937 | 65200 | } | |
| 17938 |
2/2✓ Branch 0 taken 65200 times.
✓ Branch 1 taken 203384 times.
|
268584 | if(section_version<12) //combo label |
| 17939 | { | ||
| 17940 |
2/2✓ Branch 0 taken 2237224 times.
✓ Branch 1 taken 203384 times.
|
2440608 | for ( int32_t q = 0; q < 11; q++ ) |
| 17941 | { | ||
| 17942 | 2237224 | temp_combo.label[q] = 0; | |
| 17943 | 2237224 | } | |
| 17944 | 203384 | } | |
| 17945 | //al_trace("Read combo label\n"); | ||
| 17946 |
2/2✓ Branch 0 taken 203384 times.
✓ Branch 1 taken 65200 times.
|
268584 | if(section_version>=13) //attribytes[4] |
| 17947 | { | ||
| 17948 |
2/2✓ Branch 0 taken 260800 times.
✓ Branch 1 taken 65200 times.
|
326000 | for ( int32_t q = 0; q < 4; q++ ) //Bad Zoria, don't mix constants with hardcodes |
| 17949 | { | ||
| 17950 |
1/2✓ Branch 0 taken 260800 times.
✗ Branch 1 not taken.
|
260800 | if(!p_getc(&temp_combo.attribytes[q],f,true)) |
| 17951 | { | ||
| 17952 | ✗ | return qe_invalid; | |
| 17953 | } | ||
| 17954 | 260800 | } | |
| 17955 | |||
| 17956 | 65200 | } | |
| 17957 | //al_trace("Read combo attribytes\n"); | ||
| 17958 |
2/2✓ Branch 0 taken 65200 times.
✓ Branch 1 taken 203384 times.
|
268584 | if( section_version < 13 ) |
| 17959 | { | ||
| 17960 |
2/2✓ Branch 0 taken 813536 times.
✓ Branch 1 taken 203384 times.
|
1016920 | for ( int32_t q = 0; q < NUM_COMBO_ATTRIBUTES; q++ ) |
| 17961 | { | ||
| 17962 | 813536 | temp_combo.attribytes[q] = 0; | |
| 17963 | 813536 | } | |
| 17964 | |||
| 17965 | 203384 | } | |
| 17966 | /* HIGHLY UNORTHODOX UPDATING THING, by Deedee | ||
| 17967 | * This fixes a poor implementation of a ->next flag bug thing. | ||
| 17968 | * Zoria didn't bump up the versions as liberally as he should have, but thankfully | ||
| 17969 | * there was a version bump a few weeks before a change that broke stuff. | ||
| 17970 | */ | ||
| 17971 |
3/4✓ Branch 0 taken 65200 times.
✓ Branch 1 taken 203384 times.
✓ Branch 2 taken 65200 times.
✗ Branch 3 not taken.
|
268584 | if (section_version >= 13 && section_version < 21) |
| 17972 | { | ||
| 17973 | ✗ | set_bit(quest_rules,qr_BUGGY_BUGGY_SLASH_TRIGGERS,1); | |
| 17974 | } | ||
| 17975 | //combo scripts | ||
| 17976 |
2/2✓ Branch 0 taken 203384 times.
✓ Branch 1 taken 65200 times.
|
268584 | if(section_version>=14) |
| 17977 | { | ||
| 17978 |
1/2✓ Branch 0 taken 65200 times.
✗ Branch 1 not taken.
|
65200 | if(!p_igetw(&temp_combo.script,f,true)) return qe_invalid; |
| 17979 |
2/2✓ Branch 0 taken 130400 times.
✓ Branch 1 taken 65200 times.
|
195600 | for ( int32_t q = 0; q < 2; q++ ) |
| 17980 | { | ||
| 17981 |
1/2✓ Branch 0 taken 130400 times.
✗ Branch 1 not taken.
|
130400 | if(!p_igetl(&temp_combo.initd[q],f,true)) |
| 17982 | { | ||
| 17983 | ✗ | return qe_invalid; | |
| 17984 | } | ||
| 17985 | 130400 | } | |
| 17986 | |||
| 17987 | 65200 | } | |
| 17988 |
2/2✓ Branch 0 taken 65200 times.
✓ Branch 1 taken 203384 times.
|
268584 | if(section_version<14) |
| 17989 | { | ||
| 17990 | 203384 | temp_combo.script = 0; | |
| 17991 |
2/2✓ Branch 0 taken 406768 times.
✓ Branch 1 taken 203384 times.
|
610152 | for ( int32_t q = 0; q < 2; q++ ) |
| 17992 | { | ||
| 17993 | 406768 | temp_combo.initd[q] = 0; | |
| 17994 | 406768 | } | |
| 17995 | 203384 | } | |
| 17996 | //al_trace("Read combo script data\n"); | ||
| 17997 |
2/2✓ Branch 0 taken 65200 times.
✓ Branch 1 taken 203384 times.
|
268584 | if(section_version>=15) |
| 17998 | { | ||
| 17999 |
1/2✓ Branch 0 taken 65200 times.
✗ Branch 1 not taken.
|
65200 | if(!p_igetl(&temp_combo.o_tile,f,true)) return qe_invalid; |
| 18000 |
2/2✓ Branch 0 taken 33577 times.
✓ Branch 1 taken 31623 times.
|
65200 | if(!temp_combo.o_tile) temp_combo.o_tile = temp_combo.tile; |
| 18001 |
1/2✓ Branch 0 taken 65200 times.
✗ Branch 1 not taken.
|
65200 | if(!p_getc(&temp_combo.cur_frame,f,true)) return qe_invalid; |
| 18002 |
1/2✓ Branch 0 taken 65200 times.
✗ Branch 1 not taken.
|
65200 | if(!p_getc(&temp_combo.aclk,f,true)) return qe_invalid; |
| 18003 | 65200 | } | |
| 18004 | else | ||
| 18005 | { | ||
| 18006 | 203384 | temp_combo.o_tile = temp_combo.tile; | |
| 18007 | 203384 | temp_combo.cur_frame = 0; | |
| 18008 | 203384 | temp_combo.aclk = 0; | |
| 18009 | } | ||
| 18010 |
2/2✓ Branch 0 taken 65200 times.
✓ Branch 1 taken 203384 times.
|
268584 | if(section_version>=17) //attribytes[4] |
| 18011 | { | ||
| 18012 |
2/2✓ Branch 0 taken 260800 times.
✓ Branch 1 taken 65200 times.
|
326000 | for ( int32_t q = 4; q < 8; q++ ) //bump up attribytes... |
| 18013 | { | ||
| 18014 |
1/2✓ Branch 0 taken 260800 times.
✗ Branch 1 not taken.
|
260800 | if(!p_getc(&temp_combo.attribytes[q],f,true)) |
| 18015 | { | ||
| 18016 | ✗ | return qe_invalid; | |
| 18017 | } | ||
| 18018 | 260800 | } | |
| 18019 |
2/2✓ Branch 0 taken 521600 times.
✓ Branch 1 taken 65200 times.
|
586800 | for ( int32_t q = 0; q < 8; q++ ) //...and add attrishorts |
| 18020 | { | ||
| 18021 |
1/2✓ Branch 0 taken 521600 times.
✗ Branch 1 not taken.
|
521600 | if(!p_igetw(&temp_combo.attrishorts[q],f,true)) |
| 18022 | { | ||
| 18023 | ✗ | return qe_invalid; | |
| 18024 | } | ||
| 18025 | 521600 | } | |
| 18026 | |||
| 18027 | 65200 | } | |
| 18028 | else | ||
| 18029 | { | ||
| 18030 |
2/2✓ Branch 0 taken 813536 times.
✓ Branch 1 taken 203384 times.
|
1016920 | for ( int32_t q = 4; q < 8; q++ ) //bump up attribytes... |
| 18031 | { | ||
| 18032 | 813536 | temp_combo.attribytes[q] = 0; | |
| 18033 | 813536 | } | |
| 18034 |
2/2✓ Branch 0 taken 1627072 times.
✓ Branch 1 taken 203384 times.
|
1830456 | for ( int32_t q = 0; q < 8; q++ ) //...and add attrishorts |
| 18035 | { | ||
| 18036 | 1627072 | temp_combo.attrishorts[q] = 0; | |
| 18037 | 1627072 | } | |
| 18038 | } | ||
| 18039 |
2/2✓ Branch 0 taken 65200 times.
✓ Branch 1 taken 203384 times.
|
268584 | if(section_version<18) //upper bits for .walk |
| 18040 | { | ||
| 18041 | 203384 | temp_combo.walk |= 0xF0; //All on by default for old quests -E | |
| 18042 | 203384 | } | |
| 18043 |
2/2✓ Branch 0 taken 65200 times.
✓ Branch 1 taken 203384 times.
|
268584 | if(section_version < 19) |
| 18044 | { | ||
| 18045 |
2/2✓ Branch 0 taken 813536 times.
✓ Branch 1 taken 203384 times.
|
1016920 | for(int32_t q = 0; q < 4; ++q) |
| 18046 | { | ||
| 18047 | 813536 | temp_combo.attributes[q] *= 10000L; | |
| 18048 | 813536 | } | |
| 18049 | 203384 | } | |
| 18050 | |||
| 18051 |
1/2✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
|
268584 | if(version < 0x193) |
| 18052 | { | ||
| 18053 | ✗ | for(int32_t q=0; q<11; q++) | |
| 18054 | { | ||
| 18055 | ✗ | if(!p_getc(&dummy,f,true)) | |
| 18056 | { | ||
| 18057 | ✗ | return qe_invalid; | |
| 18058 | } | ||
| 18059 | } | ||
| 18060 | } | ||
| 18061 | |||
| 18062 | //Goriya tiles were flipped around in 2.11 build 7. Compensate for the flip here. -DD | ||
| 18063 |
2/6✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 268584 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
268584 | if((version < 0x211)||((version == 0x211)&&(build<7))) |
| 18064 | { | ||
| 18065 | ✗ | if(!get_bit(quest_rules,qr_NEWENEMYTILES)) | |
| 18066 | { | ||
| 18067 | ✗ | switch(temp_combo.tile) | |
| 18068 | { | ||
| 18069 | case 130: | ||
| 18070 | ✗ | temp_combo.tile = 132; | |
| 18071 | ✗ | break; | |
| 18072 | |||
| 18073 | case 131: | ||
| 18074 | ✗ | temp_combo.tile = 133; | |
| 18075 | ✗ | break; | |
| 18076 | |||
| 18077 | case 132: | ||
| 18078 | ✗ | temp_combo.tile = 130; | |
| 18079 | ✗ | break; | |
| 18080 | |||
| 18081 | case 133: | ||
| 18082 | ✗ | temp_combo.tile = 131; | |
| 18083 | ✗ | break; | |
| 18084 | } | ||
| 18085 | } | ||
| 18086 | } | ||
| 18087 | |||
| 18088 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 268584 times.
|
268584 | if(section_version < 25) |
| 18089 | { | ||
| 18090 |
2/2✓ Branch 0 taken 2370 times.
✓ Branch 1 taken 266214 times.
|
268584 | switch(temp_combo.type) |
| 18091 | { | ||
| 18092 | case cLOCKBLOCK: case cBOSSLOCKBLOCK: | ||
| 18093 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2370 times.
|
2370 | if(!(temp_combo.usrflags & cflag3)) |
| 18094 | 2370 | temp_combo.attribytes[3] = WAV_DOOR; | |
| 18095 | 2370 | temp_combo.usrflags &= ~cflag3; | |
| 18096 | 2370 | break; | |
| 18097 | } | ||
| 18098 | 268584 | } | |
| 18099 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 268584 times.
|
268584 | if(section_version < 26) |
| 18100 | { | ||
| 18101 |
2/2✓ Branch 0 taken 268102 times.
✓ Branch 1 taken 482 times.
|
268584 | if(temp_combo.type == cARMOS) |
| 18102 | { | ||
| 18103 |
1/2✓ Branch 0 taken 482 times.
✗ Branch 1 not taken.
|
482 | if(temp_combo.usrflags & cflag1) |
| 18104 | ✗ | temp_combo.usrflags |= cflag3; | |
| 18105 | 482 | } | |
| 18106 | 268584 | } | |
| 18107 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 268584 times.
|
268584 | if(section_version < 28) |
| 18108 | { | ||
| 18109 |
2/2✓ Branch 0 taken 1240 times.
✓ Branch 1 taken 267344 times.
|
268584 | switch(temp_combo.type) |
| 18110 | { | ||
| 18111 | case cLOCKBLOCK: case cLOCKEDCHEST: | ||
| 18112 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1240 times.
|
1240 | if(temp_combo.usrflags & cflag7) |
| 18113 | ✗ | temp_combo.usrflags |= cflag8; | |
| 18114 | 1240 | else temp_combo.usrflags &= ~cflag8; | |
| 18115 | 1240 | temp_combo.usrflags &= ~cflag7; | |
| 18116 | 1240 | break; | |
| 18117 | } | ||
| 18118 |
2/2✓ Branch 0 taken 50 times.
✓ Branch 1 taken 268534 times.
|
268584 | switch(temp_combo.type) |
| 18119 | { | ||
| 18120 | case cCHEST: case cLOCKEDCHEST: case cBOSSCHEST: | ||
| 18121 | 50 | temp_combo.attrishorts[2] = -1; | |
| 18122 | 50 | temp_combo.usrflags |= cflag7; | |
| 18123 | 50 | break; | |
| 18124 | } | ||
| 18125 | 268584 | } | |
| 18126 | |||
| 18127 |
2/4✓ Branch 0 taken 268584 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 268584 times.
|
268584 | if(keepdata==true && i>=start_combo) |
| 18128 | { | ||
| 18129 | 268584 | memcpy(&combobuf[i], &temp_combo, sizeof(temp_combo)); | |
| 18130 | 268584 | } | |
| 18131 | 268584 | } | |
| 18132 | |||
| 18133 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 70 times.
|
70 | if(keepdata==true) |
| 18134 | { | ||
| 18135 |
2/6✓ Branch 0 taken 70 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 70 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
70 | if((version < 0x192)|| ((version == 0x192)&&(build<185))) |
| 18136 | { | ||
| 18137 | ✗ | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) | |
| 18138 | { | ||
| 18139 | ✗ | if(combobuf[tmpcounter].type==cHOOKSHOTONLY) | |
| 18140 | { | ||
| 18141 | ✗ | combobuf[tmpcounter].type=cLADDERHOOKSHOT; | |
| 18142 | } | ||
| 18143 | } | ||
| 18144 | } | ||
| 18145 | |||
| 18146 | //June 3 2012; ladder only is broken in 2.10 and allows the hookshot also. -Gleeok | ||
| 18147 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 70 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
70 | if(version == 0x210 && !is_zquest()) |
| 18148 | { | ||
| 18149 | ✗ | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) | |
| 18150 | ✗ | if(combobuf[tmpcounter].type == cLADDERONLY) | |
| 18151 | ✗ | combobuf[tmpcounter].type = cLADDERHOOKSHOT; | |
| 18152 | } | ||
| 18153 | |||
| 18154 |
1/2✓ Branch 0 taken 70 times.
✗ Branch 1 not taken.
|
70 | if(section_version<7) |
| 18155 | { | ||
| 18156 | ✗ | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) | |
| 18157 | { | ||
| 18158 | ✗ | switch(combobuf[tmpcounter].type) | |
| 18159 | { | ||
| 18160 | case cSLASH: | ||
| 18161 | ✗ | combobuf[tmpcounter].type=cSLASHTOUCHY; | |
| 18162 | ✗ | break; | |
| 18163 | |||
| 18164 | case cSLASHITEM: | ||
| 18165 | ✗ | combobuf[tmpcounter].type=cSLASHITEMTOUCHY; | |
| 18166 | ✗ | break; | |
| 18167 | |||
| 18168 | case cBUSH: | ||
| 18169 | ✗ | combobuf[tmpcounter].type=cBUSHTOUCHY; | |
| 18170 | ✗ | break; | |
| 18171 | |||
| 18172 | case cFLOWERS: | ||
| 18173 | ✗ | combobuf[tmpcounter].type=cFLOWERSTOUCHY; | |
| 18174 | ✗ | break; | |
| 18175 | |||
| 18176 | case cTALLGRASS: | ||
| 18177 | ✗ | combobuf[tmpcounter].type=cTALLGRASSTOUCHY; | |
| 18178 | ✗ | break; | |
| 18179 | |||
| 18180 | case cSLASHNEXT: | ||
| 18181 | ✗ | combobuf[tmpcounter].type=cSLASHNEXTTOUCHY; | |
| 18182 | ✗ | break; | |
| 18183 | |||
| 18184 | case cSLASHNEXTITEM: | ||
| 18185 | ✗ | combobuf[tmpcounter].type=cSLASHNEXTITEMTOUCHY; | |
| 18186 | ✗ | break; | |
| 18187 | |||
| 18188 | case cBUSHNEXT: | ||
| 18189 | ✗ | combobuf[tmpcounter].type=cBUSHNEXTTOUCHY; | |
| 18190 | ✗ | break; | |
| 18191 | } | ||
| 18192 | } | ||
| 18193 | } | ||
| 18194 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 69 times.
|
70 | if (section_version < 16) |
| 18195 | { | ||
| 18196 |
2/2✓ Branch 0 taken 4504320 times.
✓ Branch 1 taken 69 times.
|
4504389 | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) |
| 18197 | { | ||
| 18198 |
2/2✓ Branch 0 taken 4500390 times.
✓ Branch 1 taken 3930 times.
|
4504320 | if (combobuf[tmpcounter].type == cWATER) |
| 18199 | { | ||
| 18200 | 3930 | combobuf[tmpcounter].attributes[0] = 40000L; | |
| 18201 | 3930 | } | |
| 18202 | 4504320 | } | |
| 18203 | 69 | } | |
| 18204 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 1 times.
|
70 | if(!get_bit(quest_rules,qr_ALLOW_EDITING_COMBO_0)) |
| 18205 | { | ||
| 18206 | 1 | combobuf[0].walk = 0xF0; | |
| 18207 | 1 | combobuf[0].type = 0; | |
| 18208 | 1 | combobuf[0].flag = 0; | |
| 18209 | 1 | } | |
| 18210 | 70 | } | |
| 18211 | |||
| 18212 | //Now for the new combo alias reset | ||
| 18213 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 70 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
70 | if(section_version<2 && keepdata) |
| 18214 | { | ||
| 18215 | ✗ | for(int32_t j=0; j<MAXCOMBOALIASES; j++) | |
| 18216 | { | ||
| 18217 | ✗ | combo_aliases[j].width = 0; | |
| 18218 | ✗ | combo_aliases[j].height = 0; | |
| 18219 | ✗ | combo_aliases[j].layermask = 0; | |
| 18220 | |||
| 18221 | ✗ | if(combo_aliases[j].combos != NULL) | |
| 18222 | { | ||
| 18223 | ✗ | delete[] combo_aliases[j].combos; | |
| 18224 | } | ||
| 18225 | |||
| 18226 | ✗ | if(combo_aliases[j].csets != NULL) | |
| 18227 | { | ||
| 18228 | ✗ | delete[] combo_aliases[j].csets; | |
| 18229 | } | ||
| 18230 | |||
| 18231 | ✗ | combo_aliases[j].combos = new word[1]; | |
| 18232 | ✗ | combo_aliases[j].csets = new byte[1]; | |
| 18233 | ✗ | combo_aliases[j].combos[0] = 0; | |
| 18234 | ✗ | combo_aliases[j].csets[0] = 0; | |
| 18235 | } | ||
| 18236 | } | ||
| 18237 | |||
| 18238 | |||
| 18239 | 70 | setup_combo_animations(); | |
| 18240 | 70 | setup_combo_animations2(); | |
| 18241 | 70 | return 0; | |
| 18242 | 70 | } | |
| 18243 | 46892 | int32_t readcombo_loop(PACKFILE* f, word s_version, newcombo& temp_combo) | |
| 18244 | { | ||
| 18245 | byte combo_has_flags; | ||
| 18246 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 46892 times.
|
46892 | if(!p_getc(&combo_has_flags,f,true)) |
| 18247 | ✗ | return qe_invalid; | |
| 18248 | |||
| 18249 | 46892 | temp_combo.clear(); | |
| 18250 |
2/2✓ Branch 0 taken 27811 times.
✓ Branch 1 taken 19081 times.
|
46892 | if(combo_has_flags) |
| 18251 | { | ||
| 18252 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 19078 times.
|
19081 | if(combo_has_flags&CHAS_GENERAL) |
| 18253 | { | ||
| 18254 |
1/2✓ Branch 0 taken 19078 times.
✗ Branch 1 not taken.
|
19078 | if(!p_igetl(&temp_combo.tile,f,true)) |
| 18255 | { | ||
| 18256 | ✗ | return qe_invalid; | |
| 18257 | } | ||
| 18258 | 19078 | temp_combo.o_tile = temp_combo.tile; | |
| 18259 | |||
| 18260 |
1/2✓ Branch 0 taken 19078 times.
✗ Branch 1 not taken.
|
19078 | if(!p_getc(&temp_combo.flip,f,true)) |
| 18261 | { | ||
| 18262 | ✗ | return qe_invalid; | |
| 18263 | } | ||
| 18264 | |||
| 18265 |
1/2✓ Branch 0 taken 19078 times.
✗ Branch 1 not taken.
|
19078 | if(!p_getc(&temp_combo.walk,f,true)) |
| 18266 | { | ||
| 18267 | ✗ | return qe_invalid; | |
| 18268 | } | ||
| 18269 | |||
| 18270 |
1/2✓ Branch 0 taken 19078 times.
✗ Branch 1 not taken.
|
19078 | if(!p_getc(&temp_combo.type,f,true)) |
| 18271 | { | ||
| 18272 | ✗ | return qe_invalid; | |
| 18273 | } | ||
| 18274 | |||
| 18275 |
1/2✓ Branch 0 taken 19078 times.
✗ Branch 1 not taken.
|
19078 | if(!p_getc(&temp_combo.flag,f,true)) |
| 18276 | { | ||
| 18277 | ✗ | return qe_invalid; | |
| 18278 | } | ||
| 18279 | |||
| 18280 |
1/2✓ Branch 0 taken 19078 times.
✗ Branch 1 not taken.
|
19078 | if(!p_getc(&temp_combo.csets,f,true)) |
| 18281 | { | ||
| 18282 | ✗ | return qe_invalid; | |
| 18283 | } | ||
| 18284 | 19078 | } | |
| 18285 |
2/2✓ Branch 0 taken 19065 times.
✓ Branch 1 taken 16 times.
|
19081 | if(combo_has_flags&CHAS_SCRIPT) |
| 18286 | { | ||
| 18287 |
2/2✓ Branch 0 taken 176 times.
✓ Branch 1 taken 16 times.
|
192 | for ( int32_t q = 0; q < 11; q++ ) |
| 18288 | { | ||
| 18289 |
1/2✓ Branch 0 taken 176 times.
✗ Branch 1 not taken.
|
176 | if(!p_getc(&temp_combo.label[q],f,true)) |
| 18290 | { | ||
| 18291 | ✗ | return qe_invalid; | |
| 18292 | } | ||
| 18293 | 176 | } | |
| 18294 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_igetw(&temp_combo.script,f,true)) return qe_invalid; |
| 18295 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 16 times.
|
48 | for ( int32_t q = 0; q < 2; q++ ) |
| 18296 | { | ||
| 18297 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_igetl(&temp_combo.initd[q],f,true)) |
| 18298 | { | ||
| 18299 | ✗ | return qe_invalid; | |
| 18300 | } | ||
| 18301 | 32 | } | |
| 18302 | 16 | } | |
| 18303 |
2/2✓ Branch 0 taken 12913 times.
✓ Branch 1 taken 6168 times.
|
19081 | if(combo_has_flags&CHAS_ANIM) |
| 18304 | { | ||
| 18305 |
1/2✓ Branch 0 taken 6168 times.
✗ Branch 1 not taken.
|
6168 | if(!p_getc(&temp_combo.frames,f,true)) |
| 18306 | { | ||
| 18307 | ✗ | return qe_invalid; | |
| 18308 | } | ||
| 18309 | |||
| 18310 |
1/2✓ Branch 0 taken 6168 times.
✗ Branch 1 not taken.
|
6168 | if(!p_getc(&temp_combo.speed,f,true)) |
| 18311 | { | ||
| 18312 | ✗ | return qe_invalid; | |
| 18313 | } | ||
| 18314 | |||
| 18315 |
1/2✓ Branch 0 taken 6168 times.
✗ Branch 1 not taken.
|
6168 | if(!p_igetw(&temp_combo.nextcombo,f,true)) |
| 18316 | { | ||
| 18317 | ✗ | return qe_invalid; | |
| 18318 | } | ||
| 18319 | |||
| 18320 |
1/2✓ Branch 0 taken 6168 times.
✗ Branch 1 not taken.
|
6168 | if(!p_getc(&temp_combo.nextcset,f,true)) |
| 18321 | { | ||
| 18322 | ✗ | return qe_invalid; | |
| 18323 | } | ||
| 18324 | |||
| 18325 |
1/2✓ Branch 0 taken 6168 times.
✗ Branch 1 not taken.
|
6168 | if(!p_getc(&temp_combo.skipanim,f,true)) |
| 18326 | { | ||
| 18327 | ✗ | return qe_invalid; | |
| 18328 | } | ||
| 18329 | |||
| 18330 |
1/2✓ Branch 0 taken 6168 times.
✗ Branch 1 not taken.
|
6168 | if(!p_getc(&temp_combo.skipanimy,f,true)) |
| 18331 | { | ||
| 18332 | ✗ | return qe_invalid; | |
| 18333 | } | ||
| 18334 | |||
| 18335 |
1/2✓ Branch 0 taken 6168 times.
✗ Branch 1 not taken.
|
6168 | if(!p_getc(&temp_combo.animflags,f,true)) |
| 18336 | { | ||
| 18337 | ✗ | return qe_invalid; | |
| 18338 | } | ||
| 18339 | 6168 | } | |
| 18340 |
2/2✓ Branch 0 taken 17580 times.
✓ Branch 1 taken 1501 times.
|
19081 | if(combo_has_flags&CHAS_ATTRIB) |
| 18341 | { | ||
| 18342 |
2/2✓ Branch 0 taken 6004 times.
✓ Branch 1 taken 1501 times.
|
7505 | for ( int32_t q = 0; q < 4; q++ ) |
| 18343 | { | ||
| 18344 |
1/2✓ Branch 0 taken 6004 times.
✗ Branch 1 not taken.
|
6004 | if(!p_igetl(&temp_combo.attributes[q],f,true)) |
| 18345 | { | ||
| 18346 | ✗ | return qe_invalid; | |
| 18347 | } | ||
| 18348 | 6004 | } | |
| 18349 |
2/2✓ Branch 0 taken 12008 times.
✓ Branch 1 taken 1501 times.
|
13509 | for ( int32_t q = 0; q < 8; q++ ) |
| 18350 | { | ||
| 18351 |
1/2✓ Branch 0 taken 12008 times.
✗ Branch 1 not taken.
|
12008 | if(!p_getc(&temp_combo.attribytes[q],f,true)) |
| 18352 | { | ||
| 18353 | ✗ | return qe_invalid; | |
| 18354 | } | ||
| 18355 | 12008 | } | |
| 18356 |
2/2✓ Branch 0 taken 12008 times.
✓ Branch 1 taken 1501 times.
|
13509 | for ( int32_t q = 0; q < 8; q++ ) |
| 18357 | { | ||
| 18358 |
1/2✓ Branch 0 taken 12008 times.
✗ Branch 1 not taken.
|
12008 | if(!p_igetw(&temp_combo.attrishorts[q],f,true)) |
| 18359 | { | ||
| 18360 | ✗ | return qe_invalid; | |
| 18361 | } | ||
| 18362 | 12008 | } | |
| 18363 | 1501 | } | |
| 18364 |
2/2✓ Branch 0 taken 18565 times.
✓ Branch 1 taken 516 times.
|
19081 | if(combo_has_flags&CHAS_FLAG) |
| 18365 | { | ||
| 18366 |
1/2✓ Branch 0 taken 516 times.
✗ Branch 1 not taken.
|
516 | if(!p_igetl(&temp_combo.usrflags,f,true)) |
| 18367 | { | ||
| 18368 | ✗ | return qe_invalid; | |
| 18369 | } | ||
| 18370 |
1/2✓ Branch 0 taken 516 times.
✗ Branch 1 not taken.
|
516 | if(!p_igetw(&temp_combo.genflags,f,true)) |
| 18371 | { | ||
| 18372 | ✗ | return qe_invalid; | |
| 18373 | } | ||
| 18374 | 516 | } | |
| 18375 |
2/2✓ Branch 0 taken 18970 times.
✓ Branch 1 taken 111 times.
|
19081 | if(combo_has_flags&CHAS_TRIG) |
| 18376 | { | ||
| 18377 |
2/2✓ Branch 0 taken 333 times.
✓ Branch 1 taken 111 times.
|
444 | for ( int32_t q = 0; q < 3; q++ ) |
| 18378 | { | ||
| 18379 |
1/2✓ Branch 0 taken 333 times.
✗ Branch 1 not taken.
|
333 | if(!p_igetl(&temp_combo.triggerflags[q],f,true)) |
| 18380 | { | ||
| 18381 | ✗ | return qe_invalid; | |
| 18382 | } | ||
| 18383 | 333 | } | |
| 18384 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_igetl(&temp_combo.triggerlevel,f,true)) |
| 18385 | { | ||
| 18386 | ✗ | return qe_invalid; | |
| 18387 | } | ||
| 18388 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_getc(&temp_combo.triggerbtn,f,true)) |
| 18389 | { | ||
| 18390 | ✗ | return qe_invalid; | |
| 18391 | } | ||
| 18392 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_getc(&temp_combo.triggeritem,f,true)) |
| 18393 | { | ||
| 18394 | ✗ | return qe_invalid; | |
| 18395 | } | ||
| 18396 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_getc(&temp_combo.trigtimer,f,true)) |
| 18397 | { | ||
| 18398 | ✗ | return qe_invalid; | |
| 18399 | } | ||
| 18400 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_getc(&temp_combo.trigsfx,f,true)) |
| 18401 | { | ||
| 18402 | ✗ | return qe_invalid; | |
| 18403 | } | ||
| 18404 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_igetl(&temp_combo.trigchange,f,true)) |
| 18405 | { | ||
| 18406 | ✗ | return qe_invalid; | |
| 18407 | } | ||
| 18408 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_igetw(&temp_combo.trigprox,f,true)) |
| 18409 | { | ||
| 18410 | ✗ | return qe_invalid; | |
| 18411 | } | ||
| 18412 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_getc(&temp_combo.trigctr,f,true)) |
| 18413 | { | ||
| 18414 | ✗ | return qe_invalid; | |
| 18415 | } | ||
| 18416 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_igetl(&temp_combo.trigctramnt,f,true)) |
| 18417 | { | ||
| 18418 | ✗ | return qe_invalid; | |
| 18419 | } | ||
| 18420 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_getc(&temp_combo.triglbeam,f,true)) |
| 18421 | { | ||
| 18422 | ✗ | return qe_invalid; | |
| 18423 | } | ||
| 18424 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_getc(&temp_combo.trigcschange,f,true)) |
| 18425 | { | ||
| 18426 | ✗ | return qe_invalid; | |
| 18427 | } | ||
| 18428 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_igetw(&temp_combo.spawnitem,f,true)) |
| 18429 | { | ||
| 18430 | ✗ | return qe_invalid; | |
| 18431 | } | ||
| 18432 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_igetw(&temp_combo.spawnenemy,f,true)) |
| 18433 | { | ||
| 18434 | ✗ | return qe_invalid; | |
| 18435 | } | ||
| 18436 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_getc(&temp_combo.exstate,f,true)) |
| 18437 | { | ||
| 18438 | ✗ | return qe_invalid; | |
| 18439 | } | ||
| 18440 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_igetl(&temp_combo.spawnip,f,true)) |
| 18441 | { | ||
| 18442 | ✗ | return qe_invalid; | |
| 18443 | } | ||
| 18444 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_getc(&temp_combo.trigcopycat,f,true)) |
| 18445 | { | ||
| 18446 | ✗ | return qe_invalid; | |
| 18447 | } | ||
| 18448 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_getc(&temp_combo.trigcooldown,f,true)) |
| 18449 | { | ||
| 18450 | ✗ | return qe_invalid; | |
| 18451 | } | ||
| 18452 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 111 times.
|
111 | if(s_version >= 35) |
| 18453 | { | ||
| 18454 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_igetw(&temp_combo.prompt_cid,f,true)) |
| 18455 | { | ||
| 18456 | ✗ | return qe_invalid; | |
| 18457 | } | ||
| 18458 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_getc(&temp_combo.prompt_cs,f,true)) |
| 18459 | { | ||
| 18460 | ✗ | return qe_invalid; | |
| 18461 | } | ||
| 18462 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(!p_igetw(&temp_combo.prompt_x,f,true)) |
| 18463 | { | ||
| 18464 | ✗ | return qe_invalid; | |
| 18465 | } | ||
| 18466 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 111 times.
|
111 | if(!p_igetw(&temp_combo.prompt_y,f,true)) |
| 18467 | { | ||
| 18468 | ✗ | return qe_invalid; | |
| 18469 | } | ||
| 18470 | 111 | } | |
| 18471 | 111 | } | |
| 18472 |
2/2✓ Branch 0 taken 19057 times.
✓ Branch 1 taken 24 times.
|
19081 | if(combo_has_flags&CHAS_LIFT) |
| 18473 | { | ||
| 18474 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_igetw(&temp_combo.liftcmb,f,true)) |
| 18475 | ✗ | return qe_invalid; | |
| 18476 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&temp_combo.liftcs,f,true)) |
| 18477 | ✗ | return qe_invalid; | |
| 18478 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_igetw(&temp_combo.liftundercmb,f,true)) |
| 18479 | ✗ | return qe_invalid; | |
| 18480 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&temp_combo.liftundercs,f,true)) |
| 18481 | ✗ | return qe_invalid; | |
| 18482 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&temp_combo.liftdmg,f,true)) |
| 18483 | ✗ | return qe_invalid; | |
| 18484 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&temp_combo.liftlvl,f,true)) |
| 18485 | ✗ | return qe_invalid; | |
| 18486 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&temp_combo.liftitm,f,true)) |
| 18487 | ✗ | return qe_invalid; | |
| 18488 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&temp_combo.liftflags,f,true)) |
| 18489 | ✗ | return qe_invalid; | |
| 18490 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&temp_combo.liftgfx,f,true)) |
| 18491 | ✗ | return qe_invalid; | |
| 18492 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&temp_combo.liftsprite,f,true)) |
| 18493 | ✗ | return qe_invalid; | |
| 18494 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&temp_combo.liftsfx,f,true)) |
| 18495 | ✗ | return qe_invalid; | |
| 18496 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_igetw(&temp_combo.liftbreaksprite,f,true)) |
| 18497 | ✗ | return qe_invalid; | |
| 18498 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&temp_combo.liftbreaksfx,f,true)) |
| 18499 | ✗ | return qe_invalid; | |
| 18500 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(s_version >= 34) |
| 18501 | { | ||
| 18502 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&temp_combo.lifthei,f,true)) |
| 18503 | ✗ | return qe_invalid; | |
| 18504 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&temp_combo.lifttime,f,true)) |
| 18505 | ✗ | return qe_invalid; | |
| 18506 | 24 | } | |
| 18507 | 24 | } | |
| 18508 | 19081 | } | |
| 18509 | 46892 | return 0; | |
| 18510 | 46892 | } | |
| 18511 | 77 | int32_t readcombos(PACKFILE *f, zquestheader *Header, word version, word build, word start_combo, word max_combos, bool keepdata) | |
| 18512 | { | ||
| 18513 | 77 | word section_version=0; | |
| 18514 | 77 | word section_cversion=0; | |
| 18515 | 77 | word combos_used=0; | |
| 18516 | int32_t dummy; | ||
| 18517 | byte padding; | ||
| 18518 | 77 | newcombo temp_combo; | |
| 18519 | |||
| 18520 | 77 | reset_combo_animations(); | |
| 18521 | 77 | reset_combo_animations2(); | |
| 18522 | 77 | init_combo_classes(); | |
| 18523 | |||
| 18524 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata==true) //reset combos |
| 18525 | { | ||
| 18526 |
2/2✓ Branch 0 taken 5026560 times.
✓ Branch 1 taken 77 times.
|
5026637 | for(int32_t q = start_combo; q < start_combo+max_combos; ++q) |
| 18527 | 5026560 | combobuf[q].clear(); | |
| 18528 | 77 | } | |
| 18529 | |||
| 18530 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(version > 0x192) //Version info |
| 18531 | { | ||
| 18532 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(§ion_version,f,true)) |
| 18533 | { | ||
| 18534 | ✗ | return qe_invalid; | |
| 18535 | } | ||
| 18536 | 77 | FFCore.quest_format[vCombos] = section_version; | |
| 18537 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(§ion_cversion,f,true)) |
| 18538 | { | ||
| 18539 | ✗ | return qe_invalid; | |
| 18540 | } | ||
| 18541 | |||
| 18542 | //section size | ||
| 18543 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&dummy,f,true)) |
| 18544 | { | ||
| 18545 | ✗ | return qe_invalid; | |
| 18546 | } | ||
| 18547 | 77 | } | |
| 18548 | |||
| 18549 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 70 times.
|
77 | if(section_version > 32) //Cleanup time! |
| 18550 | { | ||
| 18551 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if(!p_igetw(&combos_used,f,true)) |
| 18552 | { | ||
| 18553 | ✗ | return qe_invalid; | |
| 18554 | } | ||
| 18555 |
2/2✓ Branch 0 taken 46892 times.
✓ Branch 1 taken 7 times.
|
46899 | for(int32_t i=0; i<combos_used; i++) |
| 18556 | { | ||
| 18557 | 46892 | auto ret = readcombo_loop(f,section_version,temp_combo); | |
| 18558 |
1/2✓ Branch 0 taken 46892 times.
✗ Branch 1 not taken.
|
46892 | if(ret) return ret; |
| 18559 |
2/4✓ Branch 0 taken 46892 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 46892 times.
|
46892 | if(keepdata==true && i>=start_combo) |
| 18560 | 46892 | memcpy(&combobuf[i], &temp_combo, sizeof(temp_combo)); | |
| 18561 | 46892 | } | |
| 18562 | 7 | } | |
| 18563 | else //Call the old function for all old versions | ||
| 18564 | { | ||
| 18565 | 70 | auto ret = readcombos_old(section_version,f,Header,version,build,start_combo,max_combos,keepdata); | |
| 18566 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 70 times.
|
70 | if(ret) return ret; //error, end read |
| 18567 | } | ||
| 18568 | |||
| 18569 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(keepdata && false/*section_version < 34*/) |
| 18570 | { | ||
| 18571 | ✗ | for(int32_t i=start_combo; i<combos_used; i++) | |
| 18572 | { | ||
| 18573 | ✗ | newcombo& cmb = combobuf[i]; | |
| 18574 | //Do anything to 'cmb' needed for version handling | ||
| 18575 | } | ||
| 18576 | } | ||
| 18577 | |||
| 18578 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata==true) |
| 18579 | { | ||
| 18580 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(!get_bit(quest_rules,qr_ALLOW_EDITING_COMBO_0)) |
| 18581 | { | ||
| 18582 | 8 | combobuf[0].walk = 0xF0; | |
| 18583 | 8 | combobuf[0].type = 0; | |
| 18584 | 8 | combobuf[0].flag = 0; | |
| 18585 | 8 | } | |
| 18586 | 77 | } | |
| 18587 | |||
| 18588 | 77 | setup_combo_animations(); | |
| 18589 | 77 | setup_combo_animations2(); | |
| 18590 | 77 | return 0; | |
| 18591 | 77 | } | |
| 18592 | |||
| 18593 | 77 | int32_t readcomboaliases(PACKFILE *f, zquestheader *Header, word version, word build, bool keepdata) | |
| 18594 | { | ||
| 18595 | //these are here to bypass compiler warnings about unused arguments | ||
| 18596 | 77 | Header=Header; | |
| 18597 | 77 | version=version; | |
| 18598 | 77 | build=build; | |
| 18599 | |||
| 18600 | int32_t dummy; | ||
| 18601 | 77 | word sversion=0, c_sversion; | |
| 18602 | |||
| 18603 | //section version info | ||
| 18604 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(!p_igetw(&sversion,f,true)) |
| 18605 | { | ||
| 18606 | ✗ | return qe_invalid; | |
| 18607 | } | ||
| 18608 | |||
| 18609 | 77 | FFCore.quest_format[vComboAliases] = sversion; | |
| 18610 | |||
| 18611 | //al_trace("Combo aliases version %d\n", sversion); | ||
| 18612 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&c_sversion,f,true)) |
| 18613 | { | ||
| 18614 | ✗ | return qe_invalid; | |
| 18615 | } | ||
| 18616 | |||
| 18617 | //section size | ||
| 18618 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&dummy,f,true)) |
| 18619 | { | ||
| 18620 | ✗ | return qe_invalid; | |
| 18621 | } | ||
| 18622 | |||
| 18623 | 77 | int32_t max_num_combo_aliases = MAXCOMBOALIASES; | |
| 18624 | |||
| 18625 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(sversion < 3) // max saved combo alias' upped from 256 to 2048. |
| 18626 | { | ||
| 18627 | 69 | max_num_combo_aliases = MAX250COMBOALIASES; | |
| 18628 | 69 | } | |
| 18629 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(sversion < 2) // max saved combo alias' upped from 256 to 2048. |
| 18630 | { | ||
| 18631 | ✗ | max_num_combo_aliases = OLDMAXCOMBOALIASES; | |
| 18632 | } | ||
| 18633 | |||
| 18634 |
2/2✓ Branch 0 taken 206848 times.
✓ Branch 1 taken 77 times.
|
206925 | for(int32_t j=0; j<max_num_combo_aliases; j++) |
| 18635 | { | ||
| 18636 | byte width,height,mask,tempcset; | ||
| 18637 | int32_t count; | ||
| 18638 | word tempword; | ||
| 18639 | byte tempbyte; | ||
| 18640 | |||
| 18641 |
1/2✓ Branch 0 taken 206848 times.
✗ Branch 1 not taken.
|
206848 | if(!p_igetw(&tempword,f,true)) |
| 18642 | { | ||
| 18643 | ✗ | return qe_invalid; | |
| 18644 | } | ||
| 18645 | |||
| 18646 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 206848 times.
|
206848 | if(keepdata) |
| 18647 | { | ||
| 18648 | 206848 | combo_aliases[j].combo = tempword; | |
| 18649 | 206848 | } | |
| 18650 | |||
| 18651 |
1/2✓ Branch 0 taken 206848 times.
✗ Branch 1 not taken.
|
206848 | if(!p_getc(&tempbyte,f,true)) |
| 18652 | { | ||
| 18653 | ✗ | return qe_invalid; | |
| 18654 | } | ||
| 18655 | |||
| 18656 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 206848 times.
|
206848 | if(keepdata) |
| 18657 | { | ||
| 18658 | 206848 | combo_aliases[j].cset = tempbyte; | |
| 18659 | 206848 | } | |
| 18660 | |||
| 18661 |
1/2✓ Branch 0 taken 206848 times.
✗ Branch 1 not taken.
|
206848 | if(!p_getc(&width,f,true)) |
| 18662 | { | ||
| 18663 | ✗ | return qe_invalid; | |
| 18664 | } | ||
| 18665 | |||
| 18666 |
1/2✓ Branch 0 taken 206848 times.
✗ Branch 1 not taken.
|
206848 | if(!p_getc(&height,f,true)) |
| 18667 | { | ||
| 18668 | ✗ | return qe_invalid; | |
| 18669 | } | ||
| 18670 | |||
| 18671 |
1/2✓ Branch 0 taken 206848 times.
✗ Branch 1 not taken.
|
206848 | if(!p_getc(&mask,f,true)) |
| 18672 | { | ||
| 18673 | ✗ | return qe_invalid; | |
| 18674 | } | ||
| 18675 | |||
| 18676 | 206848 | count=(width+1)*(height+1)*(comboa_lmasktotal(mask)+1); | |
| 18677 | |||
| 18678 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 206848 times.
|
206848 | if(keepdata) |
| 18679 | { | ||
| 18680 |
1/2✓ Branch 0 taken 206848 times.
✗ Branch 1 not taken.
|
206848 | if(combo_aliases[j].combos != NULL) |
| 18681 | { | ||
| 18682 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 206848 times.
|
206848 | delete[] combo_aliases[j].combos; |
| 18683 | 206848 | } | |
| 18684 | |||
| 18685 |
1/2✓ Branch 0 taken 206848 times.
✗ Branch 1 not taken.
|
206848 | if(combo_aliases[j].csets != NULL) |
| 18686 | { | ||
| 18687 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 206848 times.
|
206848 | delete[] combo_aliases[j].csets; |
| 18688 | 206848 | } | |
| 18689 | |||
| 18690 | 206848 | combo_aliases[j].width = width; | |
| 18691 | 206848 | combo_aliases[j].height = height; | |
| 18692 | 206848 | combo_aliases[j].layermask = mask; | |
| 18693 | 206848 | combo_aliases[j].combos = new word[count]; | |
| 18694 | 206848 | combo_aliases[j].csets = new byte[count]; | |
| 18695 | 206848 | } | |
| 18696 | |||
| 18697 |
2/2✓ Branch 0 taken 210821 times.
✓ Branch 1 taken 206848 times.
|
417669 | for(int32_t k=0; k<count; k++) |
| 18698 | { | ||
| 18699 |
1/2✓ Branch 0 taken 210821 times.
✗ Branch 1 not taken.
|
210821 | if(!p_igetw(&tempword,f,true)) |
| 18700 | { | ||
| 18701 | ✗ | return qe_invalid; | |
| 18702 | } | ||
| 18703 | |||
| 18704 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 210821 times.
|
210821 | if(keepdata) |
| 18705 | { | ||
| 18706 | 210821 | combo_aliases[j].combos[k] = tempword; | |
| 18707 | 210821 | } | |
| 18708 | 210821 | } | |
| 18709 | |||
| 18710 |
2/2✓ Branch 0 taken 210821 times.
✓ Branch 1 taken 206848 times.
|
417669 | for(int32_t k=0; k<count; k++) |
| 18711 | { | ||
| 18712 |
1/2✓ Branch 0 taken 210821 times.
✗ Branch 1 not taken.
|
210821 | if(!p_getc(&tempcset,f,true)) |
| 18713 | { | ||
| 18714 | ✗ | return qe_invalid; | |
| 18715 | } | ||
| 18716 | |||
| 18717 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 210821 times.
|
210821 | if(keepdata) |
| 18718 | { | ||
| 18719 | 210821 | combo_aliases[j].csets[k] = tempcset; | |
| 18720 | 210821 | } | |
| 18721 | 210821 | } | |
| 18722 | 206848 | } | |
| 18723 | |||
| 18724 | 77 | word num_combo_pools = 0; | |
| 18725 |
2/2✓ Branch 0 taken 70 times.
✓ Branch 1 taken 7 times.
|
77 | if(sversion >= 4) |
| 18726 | { | ||
| 18727 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if(!p_igetw(&num_combo_pools,f,true)) |
| 18728 | { | ||
| 18729 | ✗ | return qe_invalid; | |
| 18730 | } | ||
| 18731 | 7 | } | |
| 18732 | |||
| 18733 |
2/2✓ Branch 0 taken 630784 times.
✓ Branch 1 taken 77 times.
|
630861 | for(combo_pool& pool : combo_pools) |
| 18734 | { | ||
| 18735 | 630784 | pool.clear(); | |
| 18736 | } | ||
| 18737 | |||
| 18738 | 77 | combo_pool temp_cpool; | |
| 18739 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 77 times.
|
95 | for(word cp = 0; cp < num_combo_pools; ++cp) |
| 18740 | { | ||
| 18741 | 18 | int32_t num_combos_in_pool = 0; | |
| 18742 |
2/4✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
|
18 | if(!p_igetl(&num_combos_in_pool,f,true)) |
| 18743 | { | ||
| 18744 | ✗ | return qe_invalid; | |
| 18745 | } | ||
| 18746 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(num_combos_in_pool < 1) continue; //nothing to read |
| 18747 | |||
| 18748 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | temp_cpool.clear(); |
| 18749 | |||
| 18750 | int32_t cp_cid; int8_t cp_cs; word cp_quant; | ||
| 18751 |
2/2✓ Branch 0 taken 78 times.
✓ Branch 1 taken 18 times.
|
96 | for(auto q = 0; q < num_combos_in_pool; ++q) |
| 18752 | { | ||
| 18753 |
2/4✓ Branch 0 taken 78 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 78 times.
✗ Branch 3 not taken.
|
78 | if(!p_igetl(&cp_cid,f,true)) |
| 18754 | { | ||
| 18755 | ✗ | return qe_invalid; | |
| 18756 | } | ||
| 18757 |
2/4✓ Branch 0 taken 78 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 78 times.
✗ Branch 3 not taken.
|
78 | if(!p_getc(&cp_cs,f,true)) |
| 18758 | { | ||
| 18759 | ✗ | return qe_invalid; | |
| 18760 | } | ||
| 18761 |
2/4✓ Branch 0 taken 78 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 78 times.
✗ Branch 3 not taken.
|
78 | if(!p_igetw(&cp_quant,f,true)) |
| 18762 | { | ||
| 18763 | ✗ | return qe_invalid; | |
| 18764 | } | ||
| 18765 |
1/2✓ Branch 0 taken 78 times.
✗ Branch 1 not taken.
|
78 | temp_cpool.add(cp_cid, cp_cs, cp_quant); |
| 18766 | 78 | } | |
| 18767 | |||
| 18768 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(keepdata) |
| 18769 | { | ||
| 18770 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | combo_pools[cp] = temp_cpool; |
| 18771 | 18 | } | |
| 18772 | 18 | } | |
| 18773 | |||
| 18774 | 77 | return 0; | |
| 18775 | 77 | } | |
| 18776 | |||
| 18777 | 77 | int32_t readcolordata(PACKFILE *f, miscQdata *Misc, word version, word build, word start_cset, word max_csets, bool keepdata) | |
| 18778 | { | ||
| 18779 | //these are here to bypass compiler warnings about unused arguments | ||
| 18780 | |||
| 18781 | //THE *48 REFERS TO EACH CSET BEING 16 COLORS with 3 VALUES OF RGB (3*16 is 48) | ||
| 18782 | //Capitalized cause it'll save you a headache. -Deedee | ||
| 18783 | 77 | start_cset=start_cset; | |
| 18784 | 77 | max_csets=max_csets; | |
| 18785 | 77 | word s_version=0; | |
| 18786 | |||
| 18787 | miscQdata temp_misc; | ||
| 18788 | 77 | memcpy(&temp_misc, Misc, sizeof(temp_misc)); | |
| 18789 | |||
| 18790 | byte temp_colordata[48]; | ||
| 18791 | char temp_palname[PALNAMESIZE]; | ||
| 18792 | |||
| 18793 | int32_t dummy; | ||
| 18794 | word palcycles; | ||
| 18795 | |||
| 18796 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(version > 0x192) |
| 18797 | { | ||
| 18798 | //section version info | ||
| 18799 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_version,f,true)) |
| 18800 | { | ||
| 18801 | ✗ | return qe_invalid; | |
| 18802 | } | ||
| 18803 | |||
| 18804 | 77 | FFCore.quest_format[vCSets] = s_version; | |
| 18805 | |||
| 18806 | //al_trace("Color data version %d\n", s_version); | ||
| 18807 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&dummy,f,true)) |
| 18808 | { | ||
| 18809 | ✗ | return qe_invalid; | |
| 18810 | } | ||
| 18811 | |||
| 18812 | //section size | ||
| 18813 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&dummy,f,true)) |
| 18814 | { | ||
| 18815 | ✗ | return qe_invalid; | |
| 18816 | } | ||
| 18817 | 77 | } | |
| 18818 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
|
77 | if (s_version < 5) |
| 18819 | { | ||
| 18820 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 69 times.
✗ Branch 3 not taken.
|
69 | bool RealOldVerion = ((version < 0x192)||((version == 0x192)&&(build<73))); |
| 18821 | |||
| 18822 | //finally... section data | ||
| 18823 | 69 | int32_t q = 0; | |
| 18824 | 69 | int32_t p = -15; | |
| 18825 |
2/2✓ Branch 0 taken 16560 times.
✓ Branch 1 taken 69 times.
|
16629 | for(int32_t i=0; i<oldpdTOTAL; ++i) |
| 18826 | { | ||
| 18827 | 16560 | memset(temp_colordata, 0, 48); | |
| 18828 | |||
| 18829 |
1/2✓ Branch 0 taken 16560 times.
✗ Branch 1 not taken.
|
16560 | if(!pfread(temp_colordata,48,f,true)) |
| 18830 | { | ||
| 18831 | ✗ | return qe_invalid; | |
| 18832 | } | ||
| 18833 | |||
| 18834 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16560 times.
|
16560 | if(keepdata==true) |
| 18835 | { | ||
| 18836 | 16560 | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 18837 | 16560 | } | |
| 18838 | 16560 | ++q; | |
| 18839 |
7/8✓ Branch 0 taken 15456 times.
✓ Branch 1 taken 1104 times.
✓ Branch 2 taken 1173 times.
✓ Branch 3 taken 14283 times.
✓ Branch 4 taken 138 times.
✓ Branch 5 taken 1035 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 138 times.
|
16560 | if (p > 0 && (p%13)==12 && (i < oldpoSPRITE || !RealOldVerion)) //It's > 0 instead of >= 0 because it should append |
| 18840 | { | ||
| 18841 |
1/2✓ Branch 0 taken 1173 times.
✗ Branch 1 not taken.
|
1173 | if (s_version < 5) //Bumping up the size of level palettes |
| 18842 | { | ||
| 18843 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1173 times.
|
1173 | if(keepdata==true) |
| 18844 | { | ||
| 18845 | 1173 | memcpy(&colordata[(q)*48], &colordata[1*48], 48); | |
| 18846 | 1173 | memcpy(&colordata[(q+1)*48], &colordata[5*48], 48); | |
| 18847 | 1173 | memcpy(&colordata[(q+2)*48], &colordata[7*48], 48); | |
| 18848 | 1173 | memcpy(&colordata[(q+3)*48], &colordata[8*48], 48); | |
| 18849 | 1173 | } | |
| 18850 | 1173 | q+=4; | |
| 18851 | 1173 | } | |
| 18852 | else | ||
| 18853 | { | ||
| 18854 | ✗ | for(int m = 0; m < 4; ++m) | |
| 18855 | { | ||
| 18856 | ✗ | memset(temp_colordata, 0, 48); | |
| 18857 | ✗ | if(!pfread(temp_colordata,48,f,true)) | |
| 18858 | { | ||
| 18859 | ✗ | return qe_invalid; | |
| 18860 | } | ||
| 18861 | ✗ | if(keepdata==true) | |
| 18862 | { | ||
| 18863 | ✗ | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 18864 | } | ||
| 18865 | ✗ | ++q; | |
| 18866 | } | ||
| 18867 | } | ||
| 18868 | 1173 | } | |
| 18869 | 16560 | ++p; | |
| 18870 | 16560 | } | |
| 18871 | |||
| 18872 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if(RealOldVerion) |
| 18873 | { | ||
| 18874 | ✗ | if(keepdata==true) | |
| 18875 | { | ||
| 18876 | ✗ | memcpy(colordata+(poSPRITE255*48), colordata+((q-30)*48), 30*16*3); | |
| 18877 | ✗ | memset(colordata+((q-30)*48), 0, ((poSPRITE255-(q-30))*48)); | |
| 18878 | ✗ | memcpy(colordata+((poSPRITE255+11)*48), colordata+((poSPRITE255+10)*48), 48); | |
| 18879 | ✗ | memcpy(colordata+((poSPRITE255+10)*48), colordata+((poSPRITE255+9)*48), 48); | |
| 18880 | ✗ | memcpy(colordata+((poSPRITE255+9)*48), colordata+((poSPRITE255+8)*48), 48); | |
| 18881 | ✗ | memset(colordata+((poSPRITE255+8)*48), 0, 48); | |
| 18882 | } | ||
| 18883 | } | ||
| 18884 | else | ||
| 18885 | { | ||
| 18886 | 69 | memset(temp_colordata, 0, 48); | |
| 18887 | |||
| 18888 |
2/2✓ Branch 0 taken 216177 times.
✓ Branch 1 taken 69 times.
|
216246 | for(int32_t i=0; i<newpdTOTAL-oldpdTOTAL; ++i) |
| 18889 | { | ||
| 18890 |
1/2✓ Branch 0 taken 216177 times.
✗ Branch 1 not taken.
|
216177 | if(!pfread(temp_colordata,48,f,true)) |
| 18891 | { | ||
| 18892 | ✗ | return qe_invalid; | |
| 18893 | } | ||
| 18894 | |||
| 18895 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 216177 times.
|
216177 | if(keepdata==true) |
| 18896 | { | ||
| 18897 | 216177 | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 18898 | 216177 | } | |
| 18899 | 216177 | ++q; | |
| 18900 |
6/8✓ Branch 0 taken 216177 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16629 times.
✓ Branch 3 taken 199548 times.
✓ Branch 4 taken 138 times.
✓ Branch 5 taken 16491 times.
✓ Branch 6 taken 138 times.
✗ Branch 7 not taken.
|
216177 | if (p > 0 && (p%13)==12 && (i < (newpoSPRITE-oldpdTOTAL) || (s_version >= 4))) //It's > 0 instead of >= 0 because it should append |
| 18901 | { | ||
| 18902 |
1/2✓ Branch 0 taken 16629 times.
✗ Branch 1 not taken.
|
16629 | if (s_version < 5) //Bumping up the size of level palettes |
| 18903 | { | ||
| 18904 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16629 times.
|
16629 | if(keepdata==true) |
| 18905 | { | ||
| 18906 | 16629 | memcpy(&colordata[(q)*48], &colordata[1*48], 48); | |
| 18907 | 16629 | memcpy(&colordata[(q+1)*48], &colordata[5*48], 48); | |
| 18908 | 16629 | memcpy(&colordata[(q+2)*48], &colordata[7*48], 48); | |
| 18909 | 16629 | memcpy(&colordata[(q+3)*48], &colordata[8*48], 48); | |
| 18910 | 16629 | } | |
| 18911 | 16629 | q+=4; | |
| 18912 | 16629 | } | |
| 18913 | else | ||
| 18914 | { | ||
| 18915 | ✗ | for(int m = 0; m < 4; ++m) | |
| 18916 | { | ||
| 18917 | ✗ | memset(temp_colordata, 0, 48); | |
| 18918 | ✗ | if(!pfread(temp_colordata,48,f,true)) | |
| 18919 | { | ||
| 18920 | ✗ | return qe_invalid; | |
| 18921 | } | ||
| 18922 | ✗ | if(keepdata==true) | |
| 18923 | { | ||
| 18924 | ✗ | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 18925 | } | ||
| 18926 | ✗ | ++q; | |
| 18927 | } | ||
| 18928 | } | ||
| 18929 | 16629 | } | |
| 18930 | 216177 | ++p; | |
| 18931 | 216177 | } | |
| 18932 | |||
| 18933 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
|
69 | if(s_version < 4) |
| 18934 | { | ||
| 18935 | ✗ | if(keepdata==true) | |
| 18936 | { | ||
| 18937 | ✗ | memcpy(colordata+(poSPRITE255*48), colordata+((q-30)*48), 30*16*3); | |
| 18938 | ✗ | memset(colordata+((q-30)*48), 0, ((poSPRITE255-(q-30))*48)); | |
| 18939 | } | ||
| 18940 | } | ||
| 18941 | else | ||
| 18942 | { | ||
| 18943 |
2/2✓ Branch 0 taken 229632 times.
✓ Branch 1 taken 69 times.
|
229701 | for(int32_t i=0; i<newerpdTOTAL-newpdTOTAL; ++i) |
| 18944 | { | ||
| 18945 |
1/2✓ Branch 0 taken 229632 times.
✗ Branch 1 not taken.
|
229632 | if(!pfread(temp_colordata,48,f,true)) |
| 18946 | { | ||
| 18947 | ✗ | return qe_invalid; | |
| 18948 | } | ||
| 18949 | |||
| 18950 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 229632 times.
|
229632 | if(keepdata==true) |
| 18951 | { | ||
| 18952 | 229632 | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 18953 | 229632 | } | |
| 18954 | 229632 | ++q; | |
| 18955 |
5/6✓ Branch 0 taken 229632 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17664 times.
✓ Branch 3 taken 211968 times.
✓ Branch 4 taken 138 times.
✓ Branch 5 taken 17526 times.
|
229632 | if (p > 0 && (p%13)==12 && i < newerpoSPRITE-newpdTOTAL) //It's > 0 instead of >= 0 because it should append |
| 18956 | { | ||
| 18957 |
1/2✓ Branch 0 taken 17526 times.
✗ Branch 1 not taken.
|
17526 | if (s_version < 5) //Bumping up the size of level palettes |
| 18958 | { | ||
| 18959 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17526 times.
|
17526 | if(keepdata==true) |
| 18960 | { | ||
| 18961 | 17526 | memcpy(&colordata[(q)*48], &colordata[1*48], 48); | |
| 18962 | 17526 | memcpy(&colordata[(q+1)*48], &colordata[5*48], 48); | |
| 18963 | 17526 | memcpy(&colordata[(q+2)*48], &colordata[7*48], 48); | |
| 18964 | 17526 | memcpy(&colordata[(q+3)*48], &colordata[8*48], 48); | |
| 18965 | 17526 | } | |
| 18966 | 17526 | q+=4; | |
| 18967 | 17526 | } | |
| 18968 | else | ||
| 18969 | { | ||
| 18970 | ✗ | for(int m = 0; m < 4; ++m) | |
| 18971 | { | ||
| 18972 | ✗ | memset(temp_colordata, 0, 48); | |
| 18973 | ✗ | if(!pfread(temp_colordata,48,f,true)) | |
| 18974 | { | ||
| 18975 | ✗ | return qe_invalid; | |
| 18976 | } | ||
| 18977 | ✗ | if(keepdata==true) | |
| 18978 | { | ||
| 18979 | ✗ | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 18980 | } | ||
| 18981 | ✗ | ++q; | |
| 18982 | } | ||
| 18983 | } | ||
| 18984 | 17526 | } | |
| 18985 | 229632 | ++p; | |
| 18986 | 229632 | } | |
| 18987 | |||
| 18988 | //By this point, q should be about equal to pdTOTAL255. If it isn't, I've fucked up. -Deedee | ||
| 18989 | } | ||
| 18990 | } | ||
| 18991 | 69 | } | |
| 18992 | else | ||
| 18993 | { | ||
| 18994 |
2/2✓ Branch 0 taken 69992 times.
✓ Branch 1 taken 8 times.
|
70000 | for(int32_t i=0; i<pdTOTAL255; ++i) |
| 18995 | { | ||
| 18996 | 69992 | memset(temp_colordata, 0, 48); | |
| 18997 | |||
| 18998 |
1/2✓ Branch 0 taken 69992 times.
✗ Branch 1 not taken.
|
69992 | if(!pfread(temp_colordata,48,f,true)) |
| 18999 | { | ||
| 19000 | ✗ | return qe_invalid; | |
| 19001 | } | ||
| 19002 | |||
| 19003 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69992 times.
|
69992 | if(keepdata==true) |
| 19004 | { | ||
| 19005 | 69992 | memcpy(&colordata[i*48], temp_colordata, 48); | |
| 19006 | 69992 | } | |
| 19007 | 69992 | } | |
| 19008 | } | ||
| 19009 | |||
| 19010 |
2/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if((version < 0x192)||((version == 0x192)&&(build<76))) |
| 19011 | { | ||
| 19012 | ✗ | if(keepdata==true) | |
| 19013 | { | ||
| 19014 | ✗ | init_palnames(); | |
| 19015 | } | ||
| 19016 | } | ||
| 19017 | else | ||
| 19018 | { | ||
| 19019 | 77 | int32_t palnamestoread = 0; | |
| 19020 | |||
| 19021 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(s_version < 3) |
| 19022 | ✗ | palnamestoread = OLDMAXLEVELS; | |
| 19023 | else | ||
| 19024 | 77 | palnamestoread = 512; | |
| 19025 | |||
| 19026 |
2/2✓ Branch 0 taken 39424 times.
✓ Branch 1 taken 77 times.
|
39501 | for(int32_t i=0; i<palnamestoread; ++i) |
| 19027 | { | ||
| 19028 | 39424 | memset(temp_palname, 0, PALNAMESIZE); | |
| 19029 | |||
| 19030 |
1/2✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
|
39424 | if(!pfread(temp_palname,PALNAMESIZE,f,true)) |
| 19031 | { | ||
| 19032 | ✗ | return qe_invalid; | |
| 19033 | } | ||
| 19034 | |||
| 19035 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 39424 times.
|
39424 | if(keepdata==true) |
| 19036 | { | ||
| 19037 | 39424 | memcpy(palnames[i], temp_palname, PALNAMESIZE); | |
| 19038 | 39424 | } | |
| 19039 | 39424 | } | |
| 19040 | |||
| 19041 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata) |
| 19042 | { | ||
| 19043 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | for(int32_t i=palnamestoread; i<MAXLEVELS; i++) |
| 19044 | { | ||
| 19045 | ✗ | memset(palnames[i], 0, PALNAMESIZE); | |
| 19046 | } | ||
| 19047 | 77 | } | |
| 19048 | } | ||
| 19049 | |||
| 19050 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(version > 0x192) |
| 19051 | { | ||
| 19052 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<256; i++) |
| 19053 | { | ||
| 19054 |
2/2✓ Branch 0 taken 59136 times.
✓ Branch 1 taken 19712 times.
|
78848 | for(int32_t j=0; j<3; j++) |
| 19055 | { | ||
| 19056 | 59136 | temp_misc.cycles[i][j].first=0; | |
| 19057 | 59136 | temp_misc.cycles[i][j].count=0; | |
| 19058 | 59136 | temp_misc.cycles[i][j].speed=0; | |
| 19059 | 59136 | } | |
| 19060 | 19712 | } | |
| 19061 | |||
| 19062 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&palcycles,f,true)) |
| 19063 | { | ||
| 19064 | ✗ | return qe_invalid; | |
| 19065 | } | ||
| 19066 | |||
| 19067 |
2/2✓ Branch 0 taken 2604 times.
✓ Branch 1 taken 77 times.
|
2681 | for(int32_t i=0; i<palcycles; i++) |
| 19068 | { | ||
| 19069 |
2/2✓ Branch 0 taken 7812 times.
✓ Branch 1 taken 2604 times.
|
10416 | for(int32_t j=0; j<3; j++) |
| 19070 | { | ||
| 19071 |
1/2✓ Branch 0 taken 7812 times.
✗ Branch 1 not taken.
|
7812 | if(!p_getc(&temp_misc.cycles[i][j].first,f,true)) |
| 19072 | { | ||
| 19073 | ✗ | return qe_invalid; | |
| 19074 | } | ||
| 19075 | 7812 | } | |
| 19076 | |||
| 19077 |
2/2✓ Branch 0 taken 7812 times.
✓ Branch 1 taken 2604 times.
|
10416 | for(int32_t j=0; j<3; j++) |
| 19078 | { | ||
| 19079 |
1/2✓ Branch 0 taken 7812 times.
✗ Branch 1 not taken.
|
7812 | if(!p_getc(&temp_misc.cycles[i][j].count,f,true)) |
| 19080 | { | ||
| 19081 | ✗ | return qe_invalid; | |
| 19082 | } | ||
| 19083 | 7812 | } | |
| 19084 | |||
| 19085 |
2/2✓ Branch 0 taken 7812 times.
✓ Branch 1 taken 2604 times.
|
10416 | for(int32_t j=0; j<3; j++) |
| 19086 | { | ||
| 19087 |
1/2✓ Branch 0 taken 7812 times.
✗ Branch 1 not taken.
|
7812 | if(!p_getc(&temp_misc.cycles[i][j].speed,f,true)) |
| 19088 | { | ||
| 19089 | ✗ | return qe_invalid; | |
| 19090 | } | ||
| 19091 | 7812 | } | |
| 19092 | 2604 | } | |
| 19093 | |||
| 19094 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata==true) |
| 19095 | { | ||
| 19096 | 77 | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 19097 | 77 | } | |
| 19098 | 77 | } | |
| 19099 | |||
| 19100 | 77 | return 0; | |
| 19101 | 77 | } | |
| 19102 | |||
| 19103 | 77 | int32_t readtiles(PACKFILE *f, tiledata *buf, zquestheader *Header, word version, word build, word start_tile, int32_t max_tiles, bool from_init, bool keepdata) | |
| 19104 | { | ||
| 19105 | 77 | int32_t tiles_used=0; | |
| 19106 | 77 | word section_version = 0; | |
| 19107 | 77 | word section_cversion = 0; | |
| 19108 | 77 | int32_t section_size= 0; | |
| 19109 | 77 | byte *temp_tile = new byte[tilesize(tf32Bit)]; | |
| 19110 | |||
| 19111 | //Tile Expansion | ||
| 19112 | //if ( version >= 0x254 && build >= 41 ) | ||
| 19113 |
3/4✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 69 times.
|
77 | if (version < 0x254 && build < 41) |
| 19114 | { | ||
| 19115 | //al_trace("Build was < 41 when reading tiles\n"); | ||
| 19116 | 69 | max_tiles = ZC250MAXTILES; | |
| 19117 | 69 | } | |
| 19118 | |||
| 19119 | //al_trace("Max Tiles: %d\n", max_tiles); | ||
| 19120 | |||
| 19121 |
2/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if(Header!=NULL&&(!Header->data_flags[ZQ_TILES]&&!from_init)) //keep for old quests |
| 19122 | { | ||
| 19123 | ✗ | if(keepdata==true) | |
| 19124 | { | ||
| 19125 | ✗ | if(!init_tiles(true, Header)) | |
| 19126 | { | ||
| 19127 | ✗ | al_trace("Unable to initialize tiles\n"); | |
| 19128 | } | ||
| 19129 | } | ||
| 19130 | |||
| 19131 | ✗ | delete[] temp_tile; | |
| 19132 | ✗ | temp_tile=NULL; | |
| 19133 | ✗ | return 0; | |
| 19134 | } | ||
| 19135 | else | ||
| 19136 | { | ||
| 19137 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(version > 0x192) |
| 19138 | { | ||
| 19139 | //section version info | ||
| 19140 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(§ion_version,f,true)) |
| 19141 | { | ||
| 19142 | ✗ | delete[] temp_tile; | |
| 19143 | ✗ | return qe_invalid; | |
| 19144 | } | ||
| 19145 | |||
| 19146 | 77 | FFCore.quest_format[vTiles] = section_version; | |
| 19147 | |||
| 19148 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(§ion_cversion,f,true)) |
| 19149 | { | ||
| 19150 | ✗ | delete[] temp_tile; | |
| 19151 | ✗ | return qe_invalid; | |
| 19152 | } | ||
| 19153 | |||
| 19154 | //section size | ||
| 19155 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(§ion_size,f,true)) |
| 19156 | { | ||
| 19157 | ✗ | delete[] temp_tile; | |
| 19158 | ✗ | return qe_invalid; | |
| 19159 | } | ||
| 19160 | 77 | } | |
| 19161 | |||
| 19162 | //if ( build < 41 ) | ||
| 19163 | //{ | ||
| 19164 | // tiles_used = ZC250MAXTILES; | ||
| 19165 | //} | ||
| 19166 | |||
| 19167 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(version < 0x174) |
| 19168 | { | ||
| 19169 | ✗ | tiles_used=TILES_PER_PAGE*4; | |
| 19170 | } //no expanded tile space | ||
| 19171 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | else if(version < 0x191) |
| 19172 | { | ||
| 19173 | ✗ | tiles_used=OLDMAXTILES; | |
| 19174 | } | ||
| 19175 | else | ||
| 19176 | { | ||
| 19177 | //finally... section data | ||
| 19178 |
3/4✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8 times.
|
77 | if ( version >= 0x254 && build >= 41 ) //read and write the size of tiles_used properly |
| 19179 | { | ||
| 19180 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(!p_igetl(&tiles_used,f,true)) |
| 19181 | { | ||
| 19182 | ✗ | delete[] temp_tile; | |
| 19183 | ✗ | return qe_invalid; | |
| 19184 | } | ||
| 19185 | 8 | } | |
| 19186 | else | ||
| 19187 | { | ||
| 19188 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | if(!p_igetw(&tiles_used,f,true)) |
| 19189 | { | ||
| 19190 | ✗ | delete[] temp_tile; | |
| 19191 | ✗ | return qe_invalid; | |
| 19192 | } | ||
| 19193 | } | ||
| 19194 | } | ||
| 19195 | |||
| 19196 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | tiles_used=zc_min(tiles_used, max_tiles); |
| 19197 | |||
| 19198 | //if ( version < 0x254 || ( version >= 0x254 && build < 41 )) //don't do this, it crashes ZQuest. -Z | ||
| 19199 | //if ( version < 0x254 && build < 41 ) | ||
| 19200 |
3/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if ( version < 0x254 || (version == 0x254 && build < 41) ) |
| 19201 | //if ( build < 41 ) | ||
| 19202 | { | ||
| 19203 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | tiles_used=zc_min(tiles_used, ZC250MAXTILES-start_tile); |
| 19204 | 69 | } | |
| 19205 | else //2.55 | ||
| 19206 | { | ||
| 19207 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | tiles_used = zc_min(tiles_used,NEWMAXTILES-start_tile); |
| 19208 | } | ||
| 19209 | |||
| 19210 | //if ( section_version > 1 ) tiles_used = NEWMAXTILES; | ||
| 19211 | |||
| 19212 | //al_trace("tiles_used = %d\n", tiles_used); | ||
| 19213 | |||
| 19214 |
2/2✓ Branch 0 taken 1455872 times.
✓ Branch 1 taken 77 times.
|
1455949 | for(int32_t i=0; i<tiles_used; ++i) |
| 19215 | { | ||
| 19216 | 1455872 | byte format=tf4Bit; | |
| 19217 | 1455872 | memset(temp_tile, 0, tilesize(tf32Bit)); | |
| 19218 | |||
| 19219 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 1455872 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1455872 | if((version>0x211)||((version==0x211)&&(build>4))) |
| 19220 | { | ||
| 19221 |
1/2✓ Branch 0 taken 1455872 times.
✗ Branch 1 not taken.
|
1455872 | if(!p_getc(&format,f,true)) |
| 19222 | { | ||
| 19223 | ✗ | delete[] temp_tile; | |
| 19224 | ✗ | return qe_invalid; | |
| 19225 | } | ||
| 19226 | 1455872 | } | |
| 19227 |
4/4✓ Branch 0 taken 155070 times.
✓ Branch 1 taken 1300802 times.
✓ Branch 2 taken 80108 times.
✓ Branch 3 taken 74962 times.
|
1455872 | if(section_version > 2 && !format) |
| 19228 | { | ||
| 19229 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 74962 times.
|
74962 | if(keepdata) |
| 19230 | { | ||
| 19231 | 74962 | reset_tile(buf,start_tile+i,tf4Bit); | |
| 19232 | 74962 | } | |
| 19233 | 74962 | continue; | |
| 19234 | } | ||
| 19235 | |||
| 19236 |
1/2✓ Branch 0 taken 1380910 times.
✗ Branch 1 not taken.
|
1380910 | if(!pfread(temp_tile,tilesize(format),f,true)) |
| 19237 | { | ||
| 19238 | ✗ | delete[] temp_tile; | |
| 19239 | ✗ | return qe_invalid; | |
| 19240 | } | ||
| 19241 | |||
| 19242 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1380910 times.
|
1380910 | if(keepdata==true) |
| 19243 | { | ||
| 19244 | 1380910 | buf[start_tile+i].format=format; | |
| 19245 | |||
| 19246 |
1/2✓ Branch 0 taken 1380910 times.
✗ Branch 1 not taken.
|
1380910 | if(buf[start_tile+i].data) |
| 19247 | { | ||
| 19248 | 1380910 | free(buf[start_tile+i].data); | |
| 19249 | 1380910 | buf[start_tile+i].data=NULL; | |
| 19250 | 1380910 | } | |
| 19251 | |||
| 19252 | 1380910 | buf[start_tile+i].data=(byte *)malloc(tilesize(buf[start_tile+i].format)); | |
| 19253 | 1380910 | memcpy(buf[start_tile+i].data,temp_tile,tilesize(buf[start_tile+i].format)); | |
| 19254 | 1380910 | } | |
| 19255 | 1380910 | } | |
| 19256 | } | ||
| 19257 | |||
| 19258 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if ( section_version < 2 ) //write blank tile data --check s_version with this again instead? |
| 19259 | { | ||
| 19260 | //al_trace("Writing blank tile data to new tiles for build < 41\n"); | ||
| 19261 |
2/2✓ Branch 0 taken 10279620 times.
✓ Branch 1 taken 69 times.
|
10279689 | for ( int32_t q = ZC250MAXTILES; q < NEWMAXTILES; ++q ) |
| 19262 | { | ||
| 19263 | |||
| 19264 | //memcpy(buf[q].data,temp_tile,tilesize(buf[q].format)); | ||
| 19265 | 10279620 | reset_tile(buf,q,tf4Bit); | |
| 19266 | |||
| 19267 | |||
| 19268 | /* | ||
| 19269 | |||
| 19270 | byte tempbyte; | ||
| 19271 | for(int32_t i=0; i<tilesize(tf4Bit); i++) | ||
| 19272 | { | ||
| 19273 | tempbyte=buf[ZC250MAXTILES-1].data[i]; | ||
| 19274 | buf[q].data[i] = tempbyte; | ||
| 19275 | } | ||
| 19276 | //int32_t temp = tempbyte=buf[130].data[i]; | ||
| 19277 | //buf[q].data = buf[ZC250MAXTILES-1].data; | ||
| 19278 | */ | ||
| 19279 | //reset_tile(buf,q,tf4Bit); | ||
| 19280 | 10279620 | } | |
| 19281 | |||
| 19282 | 69 | } | |
| 19283 | |||
| 19284 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata==true) |
| 19285 | { | ||
| 19286 |
4/6✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
77 | if ( version < 0x254 || ( version >= 0x254 && build < 41 )) |
| 19287 | { | ||
| 19288 |
2/2✓ Branch 0 taken 3481788 times.
✓ Branch 1 taken 69 times.
|
3481857 | for(int32_t i=start_tile+tiles_used; i<max_tiles; ++i) |
| 19289 | { | ||
| 19290 | //al_trace("Resetting tiles for ZC250MAXTILES, iteration: %d\n", i); | ||
| 19291 | 3481788 | reset_tile(buf,i,tf4Bit); | |
| 19292 | 3481788 | } | |
| 19293 | 69 | } | |
| 19294 | else | ||
| 19295 | { | ||
| 19296 |
2/2✓ Branch 0 taken 1299220 times.
✓ Branch 1 taken 8 times.
|
1299228 | for(int32_t i=start_tile+tiles_used; i<max_tiles; ++i) |
| 19297 | { | ||
| 19298 | //al_trace("Resetting tiles for build 41+\n"); | ||
| 19299 | 1299220 | reset_tile(buf,i,tf4Bit); | |
| 19300 | 1299220 | } | |
| 19301 | } | ||
| 19302 | |||
| 19303 |
2/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if((version < 0x192)|| ((version == 0x192)&&(build<186))) |
| 19304 | { | ||
| 19305 | ✗ | if(get_bit(quest_rules,qr_BSZELDA)) // | |
| 19306 | { | ||
| 19307 | byte tempbyte; | ||
| 19308 | ✗ | int32_t floattile=wpnsbuf[iwSwim].tile; | |
| 19309 | |||
| 19310 | ✗ | for(int32_t i=0; i<tilesize(tf4Bit); i++) //BSZelda tiles are out of order //does this include swim tiles? | |
| 19311 | { | ||
| 19312 | ✗ | tempbyte=buf[23].data[i]; | |
| 19313 | ✗ | buf[23].data[i]=buf[24].data[i]; | |
| 19314 | ✗ | buf[24].data[i]=buf[25].data[i]; | |
| 19315 | ✗ | buf[25].data[i]=buf[26].data[i]; | |
| 19316 | ✗ | buf[26].data[i]=tempbyte; | |
| 19317 | } | ||
| 19318 | //swim tiles are out of order, too, but nobody cared? -Z | ||
| 19319 | ✗ | for(int32_t i=0; i<tilesize(tf4Bit); i++) | |
| 19320 | { | ||
| 19321 | ✗ | tempbyte=buf[floattile+11].data[i]; | |
| 19322 | ✗ | buf[floattile+11].data[i]=buf[floattile+12].data[i]; | |
| 19323 | ✗ | buf[floattile+12].data[i]=tempbyte; | |
| 19324 | } | ||
| 19325 | } | ||
| 19326 | } | ||
| 19327 | |||
| 19328 |
2/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if((version < 0x211)||((version == 0x211)&&(build<7))) //Goriya tiles are out of order |
| 19329 | { | ||
| 19330 | ✗ | if(!get_bit(quest_rules,qr_NEWENEMYTILES)) | |
| 19331 | { | ||
| 19332 | byte tempbyte; | ||
| 19333 | |||
| 19334 | ✗ | for(int32_t i=0; i<tilesize(tf4Bit); i++) | |
| 19335 | { | ||
| 19336 | ✗ | tempbyte=buf[130].data[i]; | |
| 19337 | ✗ | buf[130].data[i]=buf[132].data[i]; | |
| 19338 | ✗ | buf[132].data[i]=tempbyte; | |
| 19339 | |||
| 19340 | ✗ | tempbyte=buf[131].data[i]; | |
| 19341 | ✗ | buf[131].data[i]=buf[133].data[i]; | |
| 19342 | ✗ | buf[133].data[i]=tempbyte; | |
| 19343 | } | ||
| 19344 | } | ||
| 19345 | } | ||
| 19346 | |||
| 19347 | 77 | al_trace("Registering blank tiles\n"); | |
| 19348 | 77 | register_blank_tiles(); | |
| 19349 | 77 | } | |
| 19350 | |||
| 19351 | //memset(temp_tile, 0, tilesize(tf32Bit)); | ||
| 19352 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | delete[] temp_tile; |
| 19353 | 77 | temp_tile=NULL; | |
| 19354 | 77 | return 0; | |
| 19355 | 77 | } | |
| 19356 | |||
| 19357 | 77 | int32_t readtunes(PACKFILE *f, zquestheader *Header, zctune *tunes /*zcmidi_ *midis*/, bool keepdata) | |
| 19358 | { | ||
| 19359 | 77 | byte *mf=midi_flags; | |
| 19360 | int32_t dummy; | ||
| 19361 | word dummy2; | ||
| 19362 | // zcmidi_ temp_midi; | ||
| 19363 | int32_t tunes_to_read; | ||
| 19364 | 77 | int32_t tune_count=0; | |
| 19365 | 77 | word section_version=0; | |
| 19366 | 77 | zctune temp; | |
| 19367 | |||
| 19368 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(Header->zelda_version < 0x193) |
| 19369 | { | ||
| 19370 | // mf=Header->data_flags+ZQ_MIDIS2; | ||
| 19371 | ✗ | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<178))) | |
| 19372 | { | ||
| 19373 | ✗ | tunes_to_read=MAXCUSTOMMIDIS192b177; | |
| 19374 | } | ||
| 19375 | else | ||
| 19376 | { | ||
| 19377 | ✗ | tunes_to_read=MAXCUSTOMTUNES; | |
| 19378 | } | ||
| 19379 | } | ||
| 19380 | else | ||
| 19381 | { | ||
| 19382 | //section version info | ||
| 19383 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(§ion_version,f,true)) |
| 19384 | { | ||
| 19385 | ✗ | return qe_invalid; | |
| 19386 | } | ||
| 19387 | |||
| 19388 | 77 | FFCore.quest_format[vMIDIs] = section_version; | |
| 19389 | |||
| 19390 | //al_trace("Tunes version %d\n", section_version); | ||
| 19391 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&dummy2,f,true)) |
| 19392 | { | ||
| 19393 | ✗ | return qe_invalid; | |
| 19394 | } | ||
| 19395 | |||
| 19396 | //section size | ||
| 19397 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&dummy,f,true)) |
| 19398 | { | ||
| 19399 | ✗ | return qe_invalid; | |
| 19400 | } | ||
| 19401 | |||
| 19402 | //finally... section data | ||
| 19403 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!pfread(midi_flags,sizeof(midi_flags),f,true)) |
| 19404 | { | ||
| 19405 | ✗ | return qe_invalid; | |
| 19406 | } | ||
| 19407 | |||
| 19408 | 77 | tunes_to_read=MAXCUSTOMTUNES; | |
| 19409 | } | ||
| 19410 | |||
| 19411 |
2/2✓ Branch 0 taken 19404 times.
✓ Branch 1 taken 77 times.
|
19481 | for(int32_t i=0; i<MAXCUSTOMTUNES; ++i) |
| 19412 | { | ||
| 19413 |
2/2✓ Branch 0 taken 17957 times.
✓ Branch 1 taken 1447 times.
|
19404 | if(get_bit(mf, i)) |
| 19414 | { | ||
| 19415 | 1447 | ++tune_count; | |
| 19416 | 1447 | } | |
| 19417 | 19404 | } | |
| 19418 | |||
| 19419 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata==true) |
| 19420 | { | ||
| 19421 | 77 | reset_tunes(tunes); //reset_midis(midis); | |
| 19422 | 77 | } | |
| 19423 | |||
| 19424 |
2/2✓ Branch 0 taken 19404 times.
✓ Branch 1 taken 77 times.
|
19481 | for(int32_t i=0; i<tunes_to_read; i++) |
| 19425 | { | ||
| 19426 | 19404 | temp.clear(); //memset(&temp_midi,0,sizeof(zcmidi_)); | |
| 19427 | |||
| 19428 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19404 times.
|
19404 | if(keepdata==true) |
| 19429 | { | ||
| 19430 | 19404 | tunes[i].reset(); // reset_midi(midis+i); | |
| 19431 | 19404 | } | |
| 19432 | |||
| 19433 |
2/2✓ Branch 0 taken 17957 times.
✓ Branch 1 taken 1447 times.
|
19404 | if(get_bit(mf,i)) |
| 19434 | { | ||
| 19435 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1447 times.
|
1447 | if(section_version < 4) |
| 19436 | { | ||
| 19437 | ✗ | if(!pfread(&temp.title,sizeof(char)*20,f,true)) | |
| 19438 | { | ||
| 19439 | ✗ | return qe_invalid; | |
| 19440 | } | ||
| 19441 | } | ||
| 19442 | else | ||
| 19443 | { | ||
| 19444 |
1/2✓ Branch 0 taken 1447 times.
✗ Branch 1 not taken.
|
1447 | if(!pfread(&temp.title,sizeof(temp.title),f,true)) |
| 19445 | { | ||
| 19446 | ✗ | return qe_invalid; | |
| 19447 | } | ||
| 19448 | } | ||
| 19449 | |||
| 19450 |
1/2✓ Branch 0 taken 1447 times.
✗ Branch 1 not taken.
|
1447 | if(!p_igetl(&temp.start,f,true)) |
| 19451 | { | ||
| 19452 | ✗ | return qe_invalid; | |
| 19453 | } | ||
| 19454 | |||
| 19455 |
1/2✓ Branch 0 taken 1447 times.
✗ Branch 1 not taken.
|
1447 | if(!p_igetl(&temp.loop_start,f,true)) |
| 19456 | { | ||
| 19457 | ✗ | return qe_invalid; | |
| 19458 | } | ||
| 19459 | |||
| 19460 |
1/2✓ Branch 0 taken 1447 times.
✗ Branch 1 not taken.
|
1447 | if(!p_igetl(&temp.loop_end,f,true)) |
| 19461 | { | ||
| 19462 | ✗ | return qe_invalid; | |
| 19463 | } | ||
| 19464 | |||
| 19465 |
1/2✓ Branch 0 taken 1447 times.
✗ Branch 1 not taken.
|
1447 | if(!p_igetw(&temp.loop,f,true)) |
| 19466 | { | ||
| 19467 | ✗ | return qe_invalid; | |
| 19468 | } | ||
| 19469 | |||
| 19470 |
1/2✓ Branch 0 taken 1447 times.
✗ Branch 1 not taken.
|
1447 | if(!p_igetw(&temp.volume,f,true)) |
| 19471 | { | ||
| 19472 | ✗ | return qe_invalid; | |
| 19473 | } | ||
| 19474 | |||
| 19475 |
1/2✓ Branch 0 taken 1447 times.
✗ Branch 1 not taken.
|
1447 | if(Header->zelda_version < 0x193) |
| 19476 | { | ||
| 19477 | ✗ | if(!p_igetl(&dummy,f,true)) | |
| 19478 | { | ||
| 19479 | ✗ | return qe_invalid; | |
| 19480 | } | ||
| 19481 | } | ||
| 19482 | |||
| 19483 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1447 times.
|
1447 | if(section_version >= 3) |
| 19484 | { | ||
| 19485 |
1/2✓ Branch 0 taken 1447 times.
✗ Branch 1 not taken.
|
1447 | if(!pfread(&temp.flags,sizeof(temp.flags),f,true)) |
| 19486 | { | ||
| 19487 | ✗ | return qe_invalid; | |
| 19488 | } | ||
| 19489 | 1447 | } | |
| 19490 | |||
| 19491 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1447 times.
|
1447 | if(keepdata==true) |
| 19492 | { | ||
| 19493 | 1447 | tunes[i].copyfrom(temp); // memcpy(&midis[i], &temp_midi, sizeof(zcmidi_)); | |
| 19494 | 1447 | } | |
| 19495 | |||
| 19496 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1447 times.
|
1447 | if(section_version < 2) //= 1 || (Header->zelda_version < 0x211) || (Header->zelda_version == 0x211 && Header->build < 18)) |
| 19497 | { | ||
| 19498 | // old format - a midi is a midi | ||
| 19499 | ✗ | if(((keepdata==true?tunes[i].data:temp.data)=read_midi(f, true))==NULL) | |
| 19500 | { | ||
| 19501 | ✗ | return qe_invalid; | |
| 19502 | } | ||
| 19503 | |||
| 19504 | //yes you can do this. Isn't the ? operator awesome? :) | ||
| 19505 | ✗ | (keepdata ? tunes[i] : temp).format = MFORMAT_MIDI; | |
| 19506 | } | ||
| 19507 | else | ||
| 19508 | { | ||
| 19509 | // 'midi' could be midi or nes, gb, ... music | ||
| 19510 |
2/4✓ Branch 0 taken 1447 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1447 times.
✗ Branch 3 not taken.
|
1447 | if(!pfread(&(keepdata ? tunes[i] : temp).format,sizeof((keepdata ? tunes[i] : temp).format),f,true)) |
| 19511 | { | ||
| 19512 | ✗ | return qe_invalid; | |
| 19513 | } | ||
| 19514 | |||
| 19515 |
1/2✓ Branch 0 taken 1447 times.
✗ Branch 1 not taken.
|
1447 | zctune *ptr = (keepdata==true)?&(tunes[i]):&temp; |
| 19516 | |||
| 19517 |
1/2✓ Branch 0 taken 1447 times.
✗ Branch 1 not taken.
|
1447 | switch(temp.format) |
| 19518 | { | ||
| 19519 | case MFORMAT_MIDI: | ||
| 19520 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1447 times.
|
1447 | if((ptr->data=read_midi(f, true))==NULL) |
| 19521 | { | ||
| 19522 | ✗ | return qe_invalid; | |
| 19523 | } | ||
| 19524 | |||
| 19525 | 1447 | break; | |
| 19526 | |||
| 19527 | default: | ||
| 19528 | ✗ | return qe_invalid; | |
| 19529 | break; | ||
| 19530 | } | ||
| 19531 | } | ||
| 19532 | 1447 | } | |
| 19533 | 19404 | } | |
| 19534 | |||
| 19535 | 77 | return 0; | |
| 19536 | 77 | } | |
| 19537 | |||
| 19538 | 77 | int32_t readcheatcodes(PACKFILE *f, zquestheader *Header, bool keepdata) | |
| 19539 | { | ||
| 19540 | int32_t dummy; | ||
| 19541 | ZCHEATS tempzcheats; | ||
| 19542 | 77 | char temp_use_cheats=1; | |
| 19543 | 77 | memset(&tempzcheats, 0, sizeof(tempzcheats)); | |
| 19544 | 77 | word s_version = 0; | |
| 19545 | |||
| 19546 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(Header->zelda_version > 0x192) |
| 19547 | { | ||
| 19548 | //section version info | ||
| 19549 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_version,f,true)) |
| 19550 | { | ||
| 19551 | ✗ | return qe_invalid; | |
| 19552 | } | ||
| 19553 | |||
| 19554 | 77 | FFCore.quest_format[vCheats] = s_version; | |
| 19555 | //al_trace("Cheats version %d\n", dummy); | ||
| 19556 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&dummy,f,true)) |
| 19557 | { | ||
| 19558 | ✗ | return qe_invalid; | |
| 19559 | } | ||
| 19560 | |||
| 19561 | //section size | ||
| 19562 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&dummy,f,true)) |
| 19563 | { | ||
| 19564 | ✗ | return qe_invalid; | |
| 19565 | } | ||
| 19566 | |||
| 19567 | //finally... section data | ||
| 19568 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(!p_getc(&temp_use_cheats,f,true)) |
| 19569 | { | ||
| 19570 | ✗ | return qe_invalid; | |
| 19571 | } | ||
| 19572 | 77 | } | |
| 19573 | |||
| 19574 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(Header->data_flags[ZQ_CHEATS2]) |
| 19575 | { | ||
| 19576 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&tempzcheats.flags,f,true)) |
| 19577 | { | ||
| 19578 | ✗ | return qe_invalid; | |
| 19579 | } | ||
| 19580 | |||
| 19581 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!pfread(&tempzcheats.codes, sizeof(tempzcheats.codes), f,true)) |
| 19582 | { | ||
| 19583 | ✗ | return qe_invalid; | |
| 19584 | } | ||
| 19585 | 77 | } | |
| 19586 | |||
| 19587 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata==true) |
| 19588 | { | ||
| 19589 | 77 | memcpy(&zcheats, &tempzcheats, sizeof(tempzcheats)); | |
| 19590 | 77 | Header->data_flags[ZQ_CHEATS2]=temp_use_cheats; | |
| 19591 | 77 | } | |
| 19592 | |||
| 19593 | 77 | return 0; | |
| 19594 | 77 | } | |
| 19595 | |||
| 19596 | 215 | int32_t readinitdata(PACKFILE *f, zquestheader *Header, bool keepdata) | |
| 19597 | { | ||
| 19598 | int32_t dummy; | ||
| 19599 | 215 | word s_version=0, s_cversion=0; | |
| 19600 | byte padding; | ||
| 19601 | word tempw; | ||
| 19602 | |||
| 19603 | 215 | zinitdata temp_zinit; | |
| 19604 | |||
| 19605 | // Legacy item properties (now integrated into itemdata) | ||
| 19606 | byte sword_hearts[4]; | ||
| 19607 | byte beam_hearts[4]; | ||
| 19608 | 215 | byte beam_percent=0; | |
| 19609 | word beam_power[4]; | ||
| 19610 | 215 | byte hookshot_length=99; | |
| 19611 | 215 | byte hookshot_links=100; | |
| 19612 | 215 | byte longshot_length=99; | |
| 19613 | 215 | byte longshot_links=100; | |
| 19614 | 215 | byte moving_fairy_hearts=3; | |
| 19615 | 215 | byte moving_fairy_heart_percent=0; | |
| 19616 | 215 | byte stationary_fairy_hearts=3; | |
| 19617 | 215 | byte stationary_fairy_heart_percent=0; | |
| 19618 | 215 | byte moving_fairy_magic=0; | |
| 19619 | 215 | byte moving_fairy_magic_percent=0; | |
| 19620 | 215 | byte stationary_fairy_magic=0; | |
| 19621 | 215 | byte stationary_fairy_magic_percent=0; | |
| 19622 | 215 | byte blue_potion_hearts=100; | |
| 19623 | 215 | byte blue_potion_heart_percent=1; | |
| 19624 | 215 | byte red_potion_hearts=100; | |
| 19625 | 215 | byte red_potion_heart_percent=1; | |
| 19626 | 215 | byte blue_potion_magic=100; | |
| 19627 | 215 | byte blue_potion_magic_percent=1; | |
| 19628 | 215 | byte red_potion_magic=100; | |
| 19629 | 215 | byte red_potion_magic_percent=1; | |
| 19630 | |||
| 19631 |
2/2✓ Branch 0 taken 77 times.
✓ Branch 1 taken 138 times.
|
215 | temp_zinit.subscreen_style=get_bit(quest_rules,qr_COOLSCROLL)?1:0; |
| 19632 | |||
| 19633 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(Header->zelda_version > 0x192) |
| 19634 | { | ||
| 19635 | //section version info | ||
| 19636 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&s_version,f,true)) |
| 19637 | { | ||
| 19638 | ✗ | return qe_invalid; | |
| 19639 | } | ||
| 19640 | |||
| 19641 | 77 | FFCore.quest_format[vInitData] = s_version; | |
| 19642 | |||
| 19643 | //al_trace("Init data version %d\n", s_version); | ||
| 19644 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&s_cversion,f,true)) |
| 19645 | { | ||
| 19646 | ✗ | return qe_invalid; | |
| 19647 | } | ||
| 19648 | |||
| 19649 | //section size | ||
| 19650 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetl(&dummy,f,true)) |
| 19651 | { | ||
| 19652 | ✗ | return qe_invalid; | |
| 19653 | } | ||
| 19654 | 77 | } | |
| 19655 | |||
| 19656 | /* HIGHLY UNORTHODOX UPDATING THING, by L | ||
| 19657 | * This fixes quests made before revision 277 (such as the 'Lost Isle Build'), | ||
| 19658 | * where the speed of Pols Voice changed. It also coincided with V_INITDATA | ||
| 19659 | * changing from 13 to 14. | ||
| 19660 | */ | ||
| 19661 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(keepdata && s_version < 14) |
| 19662 | ✗ | fixpolsvoice=true; | |
| 19663 | |||
| 19664 | /* End highly unorthodox updating thing */ | ||
| 19665 | |||
| 19666 |
4/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 69 times.
✓ Branch 5 taken 8 times.
|
77 | if(s_version >= 15 && get_bit(deprecated_rules, 27)) // The int16_t-lived rule, qr_JUMPHEROLAYER3 |
| 19667 | 8 | temp_zinit.jump_hero_layer_threshold=0; | |
| 19668 | |||
| 19669 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(s_version >= 10) |
| 19670 | { | ||
| 19671 | char temp; | ||
| 19672 | |||
| 19673 | //new-style items | ||
| 19674 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t j=0; j<256; j++) |
| 19675 | { | ||
| 19676 |
2/4✓ Branch 0 taken 19712 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 19712 times.
|
19712 | if(!p_getc(&temp,f,true)) |
| 19677 | ✗ | return qe_invalid; | |
| 19678 | |||
| 19679 | 19712 | temp_zinit.items[j] = (temp != 0); | |
| 19680 | 19712 | } | |
| 19681 | 77 | } | |
| 19682 | |||
| 19683 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 61 times.
✓ Branch 5 taken 61 times.
|
77 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>26))) |
| 19684 | { | ||
| 19685 | char temp; | ||
| 19686 | |||
| 19687 | //finally... section data | ||
| 19688 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 61 times.
✓ Branch 3 taken 61 times.
|
138 | if((Header->zelda_version > 0x192)|| |
| 19689 | //new only | ||
| 19690 | ✗ | ((Header->zelda_version == 0x192)&&(Header->build>173))) | |
| 19691 | { | ||
| 19692 | //OLD-style items... sigh | ||
| 19693 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(s_version < 10) |
| 19694 | { | ||
| 19695 | ✗ | if(!p_getc(&temp,f,true)) | |
| 19696 | { | ||
| 19697 | ✗ | return qe_invalid; | |
| 19698 | } | ||
| 19699 | |||
| 19700 | ✗ | temp_zinit.items[iRaft]=(temp != 0); | |
| 19701 | |||
| 19702 | ✗ | if(!p_getc(&temp,f,true)) | |
| 19703 | { | ||
| 19704 | ✗ | return qe_invalid; | |
| 19705 | } | ||
| 19706 | |||
| 19707 | ✗ | temp_zinit.items[iLadder]=(temp != 0); | |
| 19708 | |||
| 19709 | ✗ | if(!p_getc(&temp,f,true)) | |
| 19710 | { | ||
| 19711 | ✗ | return qe_invalid; | |
| 19712 | } | ||
| 19713 | |||
| 19714 | ✗ | temp_zinit.items[iBook]=(temp != 0); | |
| 19715 | |||
| 19716 | ✗ | if(!p_getc(&temp,f,true)) | |
| 19717 | { | ||
| 19718 | ✗ | return qe_invalid; | |
| 19719 | } | ||
| 19720 | |||
| 19721 | ✗ | temp_zinit.items[iMKey]=(temp!=0); | |
| 19722 | |||
| 19723 | ✗ | if(!p_getc(&temp,f,true)) | |
| 19724 | { | ||
| 19725 | ✗ | return qe_invalid; | |
| 19726 | } | ||
| 19727 | |||
| 19728 | ✗ | temp_zinit.items[iFlippers]=(temp != 0); | |
| 19729 | |||
| 19730 | ✗ | if(!p_getc(&temp,f,true)) | |
| 19731 | { | ||
| 19732 | ✗ | return qe_invalid; | |
| 19733 | } | ||
| 19734 | |||
| 19735 | ✗ | temp_zinit.items[iBoots]=(temp!=0); | |
| 19736 | } | ||
| 19737 | 77 | } | |
| 19738 | |||
| 19739 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 138 times.
|
138 | if(s_version < 10) |
| 19740 | { | ||
| 19741 | char tempring, tempsword, tempshield, tempwallet, tempbracelet, tempamulet, tempbow; | ||
| 19742 | |||
| 19743 | ✗ | if(!p_getc(&tempring,f,true)) | |
| 19744 | { | ||
| 19745 | ✗ | return qe_invalid; | |
| 19746 | } | ||
| 19747 | |||
| 19748 | ✗ | if(!p_getc(&tempsword,f,true)) | |
| 19749 | { | ||
| 19750 | ✗ | return qe_invalid; | |
| 19751 | } | ||
| 19752 | |||
| 19753 | ✗ | if(!p_getc(&tempshield,f,true)) | |
| 19754 | { | ||
| 19755 | ✗ | return qe_invalid; | |
| 19756 | } | ||
| 19757 | |||
| 19758 | ✗ | if(!p_getc(&tempwallet,f,true)) | |
| 19759 | { | ||
| 19760 | ✗ | return qe_invalid; | |
| 19761 | } | ||
| 19762 | |||
| 19763 | ✗ | if(!p_getc(&tempbracelet,f,true)) | |
| 19764 | { | ||
| 19765 | ✗ | return qe_invalid; | |
| 19766 | } | ||
| 19767 | |||
| 19768 | ✗ | if(!p_getc(&tempamulet,f,true)) | |
| 19769 | { | ||
| 19770 | ✗ | return qe_invalid; | |
| 19771 | } | ||
| 19772 | |||
| 19773 | ✗ | if(!p_getc(&tempbow,f,true)) | |
| 19774 | { | ||
| 19775 | ✗ | return qe_invalid; | |
| 19776 | } | ||
| 19777 | |||
| 19778 | //old only | ||
| 19779 | ✗ | if((Header->zelda_version == 0x192)&&(Header->build<174)) | |
| 19780 | { | ||
| 19781 | ✗ | tempring=(tempring)?(1<<(tempring-1)):0; | |
| 19782 | ✗ | tempsword=(tempsword)?(1<<(tempsword-1)):0; | |
| 19783 | ✗ | tempshield=(tempshield)?(1<<(tempshield-1)):0; | |
| 19784 | ✗ | tempwallet=(tempwallet)?(1<<(tempwallet-1)):0; | |
| 19785 | ✗ | tempbracelet=(tempbracelet)?(1<<(tempbracelet-1)):0; | |
| 19786 | ✗ | tempamulet=(tempamulet)?(1<<(tempamulet-1)):0; | |
| 19787 | ✗ | tempbow=(tempbow)?(1<<(tempbow-1)):0; | |
| 19788 | } | ||
| 19789 | |||
| 19790 | //rings start at level 2... wtf | ||
| 19791 | //account for this -DD | ||
| 19792 | ✗ | tempring <<= 1; | |
| 19793 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_ring, tempring); | |
| 19794 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_sword, tempsword); | |
| 19795 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_shield, tempshield); | |
| 19796 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_wallet, tempwallet); | |
| 19797 | //bracelet ALSO starts at level 2 :-( -DD | ||
| 19798 | ✗ | tempbracelet<<=1; | |
| 19799 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_bracelet, tempbracelet); | |
| 19800 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_amulet, tempamulet); | |
| 19801 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_bow, tempbow); | |
| 19802 | |||
| 19803 | //new only | ||
| 19804 | ✗ | if((Header->zelda_version == 0x192)&&(Header->build>173)) | |
| 19805 | { | ||
| 19806 | ✗ | for(int32_t q=0; q<32; q++) | |
| 19807 | { | ||
| 19808 | ✗ | if(!p_getc(&padding,f,true)) | |
| 19809 | { | ||
| 19810 | ✗ | return qe_invalid; | |
| 19811 | } | ||
| 19812 | } | ||
| 19813 | } | ||
| 19814 | |||
| 19815 | char tempcandle, tempboomerang, temparrow, tempwhistle; | ||
| 19816 | |||
| 19817 | ✗ | if(!p_getc(&tempcandle,f,true)) | |
| 19818 | { | ||
| 19819 | ✗ | return qe_invalid; | |
| 19820 | } | ||
| 19821 | |||
| 19822 | ✗ | if(!p_getc(&tempboomerang,f,true)) | |
| 19823 | { | ||
| 19824 | ✗ | return qe_invalid; | |
| 19825 | } | ||
| 19826 | |||
| 19827 | ✗ | if(!p_getc(&temparrow,f,true)) | |
| 19828 | { | ||
| 19829 | ✗ | return qe_invalid; | |
| 19830 | } | ||
| 19831 | |||
| 19832 | ✗ | if(!p_getc(&temp,f,true)) | |
| 19833 | { | ||
| 19834 | ✗ | return qe_invalid; | |
| 19835 | } | ||
| 19836 | |||
| 19837 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_potion, temp); | |
| 19838 | |||
| 19839 | ✗ | if(!p_getc(&tempwhistle,f,true)) | |
| 19840 | { | ||
| 19841 | ✗ | return qe_invalid; | |
| 19842 | } | ||
| 19843 | |||
| 19844 | //old only | ||
| 19845 | ✗ | if((Header->zelda_version == 0x192)&&(Header->build<174)) | |
| 19846 | { | ||
| 19847 | ✗ | tempcandle=(tempcandle)?(1<<(tempcandle-1)):0; | |
| 19848 | ✗ | tempboomerang=(tempboomerang)?(1<<(tempboomerang-1)):0; | |
| 19849 | ✗ | temparrow=(temparrow)?(1<<(temparrow-1)):0; | |
| 19850 | ✗ | tempwhistle=(tempwhistle)?(1<<(tempwhistle-1)):0; | |
| 19851 | } | ||
| 19852 | |||
| 19853 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_candle, tempcandle); | |
| 19854 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_brang, tempboomerang); | |
| 19855 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_arrow, temparrow); | |
| 19856 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_whistle, tempwhistle); | |
| 19857 | //What about the potion...? | ||
| 19858 | |||
| 19859 | } | ||
| 19860 | |||
| 19861 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 69 times.
|
138 | if(s_version < 29) |
| 19862 | { | ||
| 19863 | //Oh sure, stick these IN THE MIDDLE OF THE ITEMS, just to make me want | ||
| 19864 | //to jab out my eye... | ||
| 19865 |
2/4✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✗ Branch 3 not taken.
|
69 | if(!p_getc(&padding,f,true)) |
| 19866 | ✗ | return qe_invalid; | |
| 19867 | 69 | temp_zinit.bombs = padding; | |
| 19868 | |||
| 19869 |
2/4✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✗ Branch 3 not taken.
|
69 | if(!p_getc(&padding,f,true)) |
| 19870 | ✗ | return qe_invalid; | |
| 19871 | 69 | temp_zinit.super_bombs = padding; | |
| 19872 | 69 | } | |
| 19873 | |||
| 19874 | //Back to more OLD item code | ||
| 19875 |
0/2✗ Branch 0 not taken.
✗ Branch 1 not taken.
|
138 | if(s_version < 10) |
| 19876 | { | ||
| 19877 | ✗ | if((Header->zelda_version > 0x192)|| | |
| 19878 | //new only | ||
| 19879 | ✗ | ((Header->zelda_version == 0x192)&&(Header->build>173))) | |
| 19880 | { | ||
| 19881 | ✗ | if(!p_getc(&temp,f,true)) | |
| 19882 | { | ||
| 19883 | ✗ | return qe_invalid; | |
| 19884 | } | ||
| 19885 | |||
| 19886 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_wand, temp); | |
| 19887 | |||
| 19888 | ✗ | if(!p_getc(&temp,f,true)) | |
| 19889 | { | ||
| 19890 | ✗ | return qe_invalid; | |
| 19891 | } | ||
| 19892 | |||
| 19893 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_letter, temp); | |
| 19894 | |||
| 19895 | ✗ | if(!p_getc(&temp,f,true)) | |
| 19896 | { | ||
| 19897 | ✗ | return qe_invalid; | |
| 19898 | } | ||
| 19899 | |||
| 19900 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_lens, temp); | |
| 19901 | |||
| 19902 | ✗ | if(!p_getc(&temp,f,true)) | |
| 19903 | { | ||
| 19904 | ✗ | return qe_invalid; | |
| 19905 | } | ||
| 19906 | |||
| 19907 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_hookshot, temp); | |
| 19908 | |||
| 19909 | ✗ | if(!p_getc(&temp,f,true)) | |
| 19910 | { | ||
| 19911 | ✗ | return qe_invalid; | |
| 19912 | } | ||
| 19913 | |||
| 19914 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_bait, temp); | |
| 19915 | |||
| 19916 | ✗ | if(!p_getc(&temp,f,true)) | |
| 19917 | { | ||
| 19918 | ✗ | return qe_invalid; | |
| 19919 | } | ||
| 19920 | |||
| 19921 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_hammer, temp); | |
| 19922 | |||
| 19923 | ✗ | if(!p_getc(&temp,f,true)) | |
| 19924 | { | ||
| 19925 | ✗ | return qe_invalid; | |
| 19926 | } | ||
| 19927 | |||
| 19928 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_dinsfire, temp); | |
| 19929 | |||
| 19930 | ✗ | if(!p_getc(&temp,f,true)) | |
| 19931 | { | ||
| 19932 | ✗ | return qe_invalid; | |
| 19933 | } | ||
| 19934 | |||
| 19935 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_faroreswind, temp); | |
| 19936 | |||
| 19937 | ✗ | if(!p_getc(&temp,f,true)) | |
| 19938 | { | ||
| 19939 | ✗ | return qe_invalid; | |
| 19940 | } | ||
| 19941 | |||
| 19942 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_nayruslove, temp); | |
| 19943 | |||
| 19944 | ✗ | if(!p_getc(&temp,f,true)) | |
| 19945 | { | ||
| 19946 | ✗ | return qe_invalid; | |
| 19947 | } | ||
| 19948 | |||
| 19949 | ✗ | if(Header->zelda_version == 0x192) | |
| 19950 | { | ||
| 19951 | ✗ | for(int32_t q=0; q<32; q++) | |
| 19952 | { | ||
| 19953 | ✗ | if(!p_getc(&padding,f,true)) | |
| 19954 | { | ||
| 19955 | ✗ | return qe_invalid; | |
| 19956 | } | ||
| 19957 | } | ||
| 19958 | } | ||
| 19959 | } | ||
| 19960 | } | ||
| 19961 | |||
| 19962 | //old only | ||
| 19963 | ✗ | if((Header->zelda_version == 0x192)&&(Header->build<174)) | |
| 19964 | { | ||
| 19965 | byte equipment, items; //bit flags | ||
| 19966 | |||
| 19967 | ✗ | if(!p_getc(&equipment,f,true)) | |
| 19968 | { | ||
| 19969 | ✗ | return qe_invalid; | |
| 19970 | } | ||
| 19971 | |||
| 19972 | ✗ | temp_zinit.items[iRaft]=(get_bit(&equipment, idE_RAFT)!=0); | |
| 19973 | ✗ | temp_zinit.items[iLadder]=(get_bit(&equipment, idE_LADDER)!=0); | |
| 19974 | ✗ | temp_zinit.items[iBook]=(get_bit(&equipment, idE_BOOK)!=0); | |
| 19975 | ✗ | temp_zinit.items[iMKey]=(get_bit(&equipment, idE_KEY)!=0); | |
| 19976 | ✗ | temp_zinit.items[iFlippers]=(get_bit(&equipment, idE_FLIPPERS)!=0); | |
| 19977 | ✗ | temp_zinit.items[iBoots]=(get_bit(&equipment, idE_BOOTS)!=0); | |
| 19978 | |||
| 19979 | |||
| 19980 | ✗ | if(!p_getc(&items,f,true)) | |
| 19981 | { | ||
| 19982 | ✗ | return qe_invalid; | |
| 19983 | } | ||
| 19984 | |||
| 19985 | ✗ | temp_zinit.items[iWand]=(get_bit(&items, idI_WAND)!=0); | |
| 19986 | ✗ | temp_zinit.items[iLetter]=(get_bit(&items, idI_LETTER)!=0); | |
| 19987 | ✗ | temp_zinit.items[iLens]=(get_bit(&items, idI_LENS)!=0); | |
| 19988 | ✗ | temp_zinit.items[iHookshot]=(get_bit(&items, idI_HOOKSHOT)!=0); | |
| 19989 | ✗ | temp_zinit.items[iBait]=(get_bit(&items, idI_BAIT)!=0); | |
| 19990 | ✗ | temp_zinit.items[iHammer]=(get_bit(&items, idI_HAMMER)!=0); | |
| 19991 | } | ||
| 19992 | |||
| 19993 | ✗ | if(!p_getc(&temp_zinit.hc,f,true)) | |
| 19994 | { | ||
| 19995 | ✗ | return qe_invalid; | |
| 19996 | } | ||
| 19997 | |||
| 19998 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(s_version < 14) |
| 19999 | { | ||
| 20000 | byte temphp; | ||
| 20001 | |||
| 20002 | ✗ | if(!p_getc(&temphp,f,true)) | |
| 20003 | { | ||
| 20004 | ✗ | return qe_invalid; | |
| 20005 | } | ||
| 20006 | |||
| 20007 | ✗ | temp_zinit.start_heart=temphp; | |
| 20008 | |||
| 20009 | ✗ | if(!p_getc(&temphp,f,true)) | |
| 20010 | { | ||
| 20011 | ✗ | return qe_invalid; | |
| 20012 | } | ||
| 20013 | |||
| 20014 | ✗ | temp_zinit.cont_heart=temphp; | |
| 20015 | } | ||
| 20016 | else | ||
| 20017 | { | ||
| 20018 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&temp_zinit.start_heart,f,true)) |
| 20019 | { | ||
| 20020 | ✗ | return qe_invalid; | |
| 20021 | } | ||
| 20022 | |||
| 20023 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&temp_zinit.cont_heart,f,true)) |
| 20024 | { | ||
| 20025 | ✗ | return qe_invalid; | |
| 20026 | } | ||
| 20027 | } | ||
| 20028 | |||
| 20029 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_getc(&temp_zinit.hcp,f,true)) |
| 20030 | { | ||
| 20031 | ✗ | return qe_invalid; | |
| 20032 | } | ||
| 20033 | |||
| 20034 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version >= 14) |
| 20035 | { | ||
| 20036 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_getc(&temp_zinit.hcp_per_hc,f,true)) |
| 20037 | { | ||
| 20038 | ✗ | return qe_invalid; | |
| 20039 | } | ||
| 20040 | |||
| 20041 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(s_version<16) // July 2007 |
| 20042 | { | ||
| 20043 | ✗ | if(get_bit(quest_rules,qr_BRANGPICKUP+1)) | |
| 20044 | ✗ | temp_zinit.hcp_per_hc = 0xFF; | |
| 20045 | |||
| 20046 | //Dispose of legacy rule | ||
| 20047 | ✗ | set_bit(quest_rules,qr_BRANGPICKUP+1, 0); | |
| 20048 | } | ||
| 20049 | 77 | } | |
| 20050 | |||
| 20051 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
|
77 | if(s_version < 29) |
| 20052 | { | ||
| 20053 |
2/4✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✗ Branch 3 not taken.
|
69 | if(!p_getc(&padding,f,true)) |
| 20054 | ✗ | return qe_invalid; | |
| 20055 | 69 | temp_zinit.max_bombs = padding; | |
| 20056 | 69 | } | |
| 20057 | |||
| 20058 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_getc(&temp_zinit.keys,f,true)) |
| 20059 | { | ||
| 20060 | ✗ | return qe_invalid; | |
| 20061 | } | ||
| 20062 | |||
| 20063 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&temp_zinit.rupies,f,true)) |
| 20064 | { | ||
| 20065 | ✗ | return qe_invalid; | |
| 20066 | } | ||
| 20067 | |||
| 20068 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_getc(&temp_zinit.triforce,f,true)) |
| 20069 | { | ||
| 20070 | ✗ | return qe_invalid; | |
| 20071 | } | ||
| 20072 | |||
| 20073 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if(s_version>12 || (Header->zelda_version == 0x211 && Header->build == 18)) |
| 20074 | { | ||
| 20075 |
2/2✓ Branch 0 taken 4928 times.
✓ Branch 1 taken 77 times.
|
5005 | for(int32_t i=0; i<64; i++) |
| 20076 | { | ||
| 20077 |
2/4✓ Branch 0 taken 4928 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4928 times.
|
4928 | if(!p_getc(&temp_zinit.map[i],f,true)) |
| 20078 | { | ||
| 20079 | ✗ | return qe_invalid; | |
| 20080 | } | ||
| 20081 | 4928 | } | |
| 20082 | |||
| 20083 |
2/2✓ Branch 0 taken 4928 times.
✓ Branch 1 taken 77 times.
|
5005 | for(int32_t i=0; i<64; i++) |
| 20084 | { | ||
| 20085 |
2/4✓ Branch 0 taken 4928 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4928 times.
|
4928 | if(!p_getc(&temp_zinit.compass[i],f,true)) |
| 20086 | { | ||
| 20087 | ✗ | return qe_invalid; | |
| 20088 | } | ||
| 20089 | 4928 | } | |
| 20090 | 77 | } | |
| 20091 | else | ||
| 20092 | { | ||
| 20093 | ✗ | for(int32_t i=0; i<32; i++) | |
| 20094 | { | ||
| 20095 | ✗ | if(!p_getc(&temp_zinit.map[i],f,true)) | |
| 20096 | { | ||
| 20097 | ✗ | return qe_invalid; | |
| 20098 | } | ||
| 20099 | } | ||
| 20100 | |||
| 20101 | ✗ | for(int32_t i=0; i<32; i++) | |
| 20102 | { | ||
| 20103 | ✗ | if(!p_getc(&temp_zinit.compass[i],f,true)) | |
| 20104 | { | ||
| 20105 | ✗ | return qe_invalid; | |
| 20106 | } | ||
| 20107 | } | ||
| 20108 | } | ||
| 20109 | |||
| 20110 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
77 | if((Header->zelda_version > 0x192)|| |
| 20111 | //new only | ||
| 20112 | ✗ | ((Header->zelda_version == 0x192)&&(Header->build>173))) | |
| 20113 | { | ||
| 20114 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if(s_version>12 || (Header->zelda_version == 0x211 && Header->build == 18)) |
| 20115 | { | ||
| 20116 |
2/2✓ Branch 0 taken 4928 times.
✓ Branch 1 taken 77 times.
|
5005 | for(int32_t i=0; i<64; i++) |
| 20117 | { | ||
| 20118 |
2/4✓ Branch 0 taken 4928 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4928 times.
|
4928 | if(!p_getc(&temp_zinit.boss_key[i],f,true)) |
| 20119 | { | ||
| 20120 | ✗ | return qe_invalid; | |
| 20121 | } | ||
| 20122 | 4928 | } | |
| 20123 | 77 | } | |
| 20124 | else | ||
| 20125 | { | ||
| 20126 | ✗ | for(int32_t i=0; i<32; i++) | |
| 20127 | { | ||
| 20128 | ✗ | if(!p_getc(&temp_zinit.boss_key[i],f,true)) | |
| 20129 | { | ||
| 20130 | ✗ | return qe_invalid; | |
| 20131 | } | ||
| 20132 | } | ||
| 20133 | } | ||
| 20134 | 77 | } | |
| 20135 | |||
| 20136 |
2/2✓ Branch 0 taken 77 times.
✓ Branch 1 taken 1232 times.
|
1309 | for(int32_t i=0; i<16; i++) |
| 20137 | { | ||
| 20138 |
2/4✓ Branch 0 taken 1232 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1232 times.
|
1232 | if(!p_getc(&temp_zinit.misc[i],f,true)) |
| 20139 | { | ||
| 20140 | ✗ | return qe_invalid; | |
| 20141 | } | ||
| 20142 | 1232 | } | |
| 20143 | |||
| 20144 |
1/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
77 | if(s_version < 15) for(int32_t i=0; i<4; i++) |
| 20145 | { | ||
| 20146 | ✗ | if(!p_getc(&sword_hearts[i],f,true)) | |
| 20147 | { | ||
| 20148 | ✗ | return qe_invalid; | |
| 20149 | } | ||
| 20150 | } | ||
| 20151 | |||
| 20152 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_getc(&temp_zinit.last_map,f,true)) |
| 20153 | { | ||
| 20154 | ✗ | return qe_invalid; | |
| 20155 | } | ||
| 20156 | |||
| 20157 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_getc(&temp_zinit.last_screen,f,true)) |
| 20158 | { | ||
| 20159 | ✗ | return qe_invalid; | |
| 20160 | } | ||
| 20161 | |||
| 20162 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(s_version < 14) |
| 20163 | { | ||
| 20164 | byte tempmp; | ||
| 20165 | |||
| 20166 | ✗ | if(!p_getc(&tempmp,f,true)) | |
| 20167 | { | ||
| 20168 | ✗ | return qe_invalid; | |
| 20169 | } | ||
| 20170 | |||
| 20171 | ✗ | temp_zinit.max_magic=tempmp; | |
| 20172 | |||
| 20173 | ✗ | if(!p_getc(&tempmp,f,true)) | |
| 20174 | { | ||
| 20175 | ✗ | return qe_invalid; | |
| 20176 | } | ||
| 20177 | |||
| 20178 | ✗ | temp_zinit.magic=tempmp; | |
| 20179 | } | ||
| 20180 | else | ||
| 20181 | { | ||
| 20182 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&temp_zinit.max_magic,f,true)) |
| 20183 | { | ||
| 20184 | ✗ | return qe_invalid; | |
| 20185 | } | ||
| 20186 | |||
| 20187 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&temp_zinit.magic,f,true)) |
| 20188 | { | ||
| 20189 | ✗ | return qe_invalid; | |
| 20190 | } | ||
| 20191 | } | ||
| 20192 | |||
| 20193 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version < 15) |
| 20194 | { | ||
| 20195 | ✗ | if(s_version < 12) | |
| 20196 | { | ||
| 20197 | ✗ | temp_zinit.max_magic*=32; | |
| 20198 | ✗ | temp_zinit.magic*=32; | |
| 20199 | } | ||
| 20200 | |||
| 20201 | ✗ | for(int32_t i=0; i<4; i++) | |
| 20202 | { | ||
| 20203 | ✗ | if(!p_getc(&beam_hearts[i],f,true)) | |
| 20204 | { | ||
| 20205 | ✗ | return qe_invalid; | |
| 20206 | } | ||
| 20207 | } | ||
| 20208 | |||
| 20209 | ✗ | if(!p_getc(&beam_percent,f,true)) | |
| 20210 | { | ||
| 20211 | ✗ | return qe_invalid; | |
| 20212 | } | ||
| 20213 | } | ||
| 20214 | else | ||
| 20215 | { | ||
| 20216 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_getc(&temp_zinit.bomb_ratio,f,true)) |
| 20217 | { | ||
| 20218 | ✗ | return qe_invalid; | |
| 20219 | } | ||
| 20220 | } | ||
| 20221 | |||
| 20222 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version < 15) |
| 20223 | { | ||
| 20224 | byte tempbp; | ||
| 20225 | |||
| 20226 | ✗ | for(int32_t i=0; i<4; i++) | |
| 20227 | { | ||
| 20228 | ✗ | if(!(s_version < 14 ? p_getc(&tempbp,f,true) : p_igetw(&tempbp,f,true))) | |
| 20229 | { | ||
| 20230 | ✗ | return qe_invalid; | |
| 20231 | } | ||
| 20232 | |||
| 20233 | ✗ | beam_power[i]=tempbp; | |
| 20234 | } | ||
| 20235 | |||
| 20236 | ✗ | if(!p_getc(&hookshot_links,f,true)) | |
| 20237 | { | ||
| 20238 | ✗ | return qe_invalid; | |
| 20239 | } | ||
| 20240 | |||
| 20241 | ✗ | if(s_version>6) | |
| 20242 | { | ||
| 20243 | ✗ | if(!p_getc(&hookshot_length,f,true)) | |
| 20244 | { | ||
| 20245 | ✗ | return qe_invalid; | |
| 20246 | } | ||
| 20247 | |||
| 20248 | ✗ | if(!p_getc(&longshot_links,f,true)) | |
| 20249 | { | ||
| 20250 | ✗ | return qe_invalid; | |
| 20251 | } | ||
| 20252 | |||
| 20253 | ✗ | if(!p_getc(&longshot_length,f,true)) | |
| 20254 | { | ||
| 20255 | ✗ | return qe_invalid; | |
| 20256 | } | ||
| 20257 | } | ||
| 20258 | } | ||
| 20259 | |||
| 20260 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_getc(&temp_zinit.msg_more_x,f,true)) |
| 20261 | { | ||
| 20262 | ✗ | return qe_invalid; | |
| 20263 | } | ||
| 20264 | |||
| 20265 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_getc(&temp_zinit.msg_more_y,f,true)) |
| 20266 | { | ||
| 20267 | ✗ | return qe_invalid; | |
| 20268 | } | ||
| 20269 | |||
| 20270 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_getc(&temp_zinit.subscreen,f,true)) |
| 20271 | { | ||
| 20272 | ✗ | return qe_invalid; | |
| 20273 | } | ||
| 20274 | |||
| 20275 | //old only | ||
| 20276 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
77 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 20277 | { | ||
| 20278 | ✗ | for(int32_t i=0; i<32; i++) | |
| 20279 | { | ||
| 20280 | ✗ | if(!p_getc(&temp_zinit.boss_key[i],f,true)) | |
| 20281 | { | ||
| 20282 | ✗ | return qe_invalid; | |
| 20283 | } | ||
| 20284 | } | ||
| 20285 | } | ||
| 20286 | |||
| 20287 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>173))) //new only |
| 20288 | { | ||
| 20289 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(s_version <= 10) |
| 20290 | { | ||
| 20291 | byte tempbyte; | ||
| 20292 | |||
| 20293 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 20294 | { | ||
| 20295 | ✗ | return qe_invalid; | |
| 20296 | } | ||
| 20297 | |||
| 20298 | ✗ | temp_zinit.start_dmap = (word)tempbyte; | |
| 20299 | } | ||
| 20300 | else | ||
| 20301 | { | ||
| 20302 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&temp_zinit.start_dmap,f,true)) |
| 20303 | { | ||
| 20304 | ✗ | return qe_invalid; | |
| 20305 | } | ||
| 20306 | } | ||
| 20307 | |||
| 20308 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_getc(&temp_zinit.heroAnimationStyle,f,true)) |
| 20309 | { | ||
| 20310 | ✗ | return qe_invalid; | |
| 20311 | } | ||
| 20312 | 77 | } | |
| 20313 | |||
| 20314 |
3/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✓ Branch 3 taken 8 times.
|
77 | if(s_version>1 && s_version < 29) |
| 20315 | { | ||
| 20316 |
2/4✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✗ Branch 3 not taken.
|
69 | if(!p_getc(&padding,f,true)) |
| 20317 | ✗ | return qe_invalid; | |
| 20318 | 69 | temp_zinit.arrows = padding; | |
| 20319 | |||
| 20320 |
2/4✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✗ Branch 3 not taken.
|
69 | if(!p_getc(&padding,f,true)) |
| 20321 | ✗ | return qe_invalid; | |
| 20322 | 69 | temp_zinit.max_arrows = padding; | |
| 20323 | 69 | } | |
| 20324 | |||
| 20325 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(s_version>2) |
| 20326 | { | ||
| 20327 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(s_version <= 10) |
| 20328 | { | ||
| 20329 | ✗ | for(int32_t i=0; i<OLDMAXLEVELS; i++) | |
| 20330 | { | ||
| 20331 | ✗ | if(!p_getc(&(temp_zinit.level_keys[i]),f,true)) | |
| 20332 | { | ||
| 20333 | ✗ | return qe_invalid; | |
| 20334 | } | ||
| 20335 | } | ||
| 20336 | } | ||
| 20337 | else | ||
| 20338 | { | ||
| 20339 |
2/2✓ Branch 0 taken 39424 times.
✓ Branch 1 taken 77 times.
|
39501 | for(int32_t i=0; i<MAXLEVELS; i++) |
| 20340 | { | ||
| 20341 |
2/4✓ Branch 0 taken 39424 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 39424 times.
✗ Branch 3 not taken.
|
39424 | if(!p_getc(&(temp_zinit.level_keys[i]),f,true)) |
| 20342 | { | ||
| 20343 | ✗ | return qe_invalid; | |
| 20344 | } | ||
| 20345 | 39424 | } | |
| 20346 | } | ||
| 20347 | 77 | } | |
| 20348 | |||
| 20349 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version>3) |
| 20350 | { | ||
| 20351 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&temp_zinit.ss_grid_x,f,true)) |
| 20352 | { | ||
| 20353 | ✗ | return qe_invalid; | |
| 20354 | } | ||
| 20355 | |||
| 20356 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&temp_zinit.ss_grid_y,f,true)) |
| 20357 | { | ||
| 20358 | ✗ | return qe_invalid; | |
| 20359 | } | ||
| 20360 | |||
| 20361 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&temp_zinit.ss_grid_xofs,f,true)) |
| 20362 | { | ||
| 20363 | ✗ | return qe_invalid; | |
| 20364 | } | ||
| 20365 | |||
| 20366 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&temp_zinit.ss_grid_yofs,f,true)) |
| 20367 | { | ||
| 20368 | ✗ | return qe_invalid; | |
| 20369 | } | ||
| 20370 | |||
| 20371 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&temp_zinit.ss_grid_color,f,true)) |
| 20372 | { | ||
| 20373 | ✗ | return qe_invalid; | |
| 20374 | } | ||
| 20375 | |||
| 20376 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&temp_zinit.ss_bbox_1_color,f,true)) |
| 20377 | { | ||
| 20378 | ✗ | return qe_invalid; | |
| 20379 | } | ||
| 20380 | |||
| 20381 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&temp_zinit.ss_bbox_2_color,f,true)) |
| 20382 | { | ||
| 20383 | ✗ | return qe_invalid; | |
| 20384 | } | ||
| 20385 | |||
| 20386 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&temp_zinit.ss_flags,f,true)) |
| 20387 | { | ||
| 20388 | ✗ | return qe_invalid; | |
| 20389 | } | ||
| 20390 | |||
| 20391 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | temp_zinit.ss_grid_x=zc_max(temp_zinit.ss_grid_x,1); |
| 20392 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | temp_zinit.ss_grid_y=zc_max(temp_zinit.ss_grid_y,1); |
| 20393 | 77 | } | |
| 20394 | |||
| 20395 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | if(s_version>4 && s_version<15) |
| 20396 | { | ||
| 20397 | ✗ | if(!p_getc(&moving_fairy_hearts,f,true)) | |
| 20398 | { | ||
| 20399 | ✗ | return qe_invalid; | |
| 20400 | } | ||
| 20401 | |||
| 20402 | ✗ | if(!p_getc(&moving_fairy_heart_percent,f,true)) | |
| 20403 | { | ||
| 20404 | ✗ | return qe_invalid; | |
| 20405 | } | ||
| 20406 | } | ||
| 20407 | |||
| 20408 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | if(s_version>5 && s_version < 10) |
| 20409 | { | ||
| 20410 | ✗ | if(!p_getc(&temp,f,true)) | |
| 20411 | { | ||
| 20412 | ✗ | return qe_invalid; | |
| 20413 | } | ||
| 20414 | |||
| 20415 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_quiver, temp); | |
| 20416 | } | ||
| 20417 | |||
| 20418 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | if(s_version>6 && s_version<15) |
| 20419 | { | ||
| 20420 | ✗ | if(!p_getc(&stationary_fairy_hearts,f,true)) | |
| 20421 | { | ||
| 20422 | ✗ | return qe_invalid; | |
| 20423 | } | ||
| 20424 | |||
| 20425 | ✗ | if(!p_getc(&stationary_fairy_heart_percent,f,true)) | |
| 20426 | { | ||
| 20427 | ✗ | return qe_invalid; | |
| 20428 | } | ||
| 20429 | |||
| 20430 | ✗ | if(!p_getc(&moving_fairy_magic,f,true)) | |
| 20431 | { | ||
| 20432 | ✗ | return qe_invalid; | |
| 20433 | } | ||
| 20434 | |||
| 20435 | ✗ | if(!p_getc(&moving_fairy_magic_percent,f,true)) | |
| 20436 | { | ||
| 20437 | ✗ | return qe_invalid; | |
| 20438 | } | ||
| 20439 | |||
| 20440 | ✗ | if(!p_getc(&stationary_fairy_magic,f,true)) | |
| 20441 | { | ||
| 20442 | ✗ | return qe_invalid; | |
| 20443 | } | ||
| 20444 | |||
| 20445 | ✗ | if(!p_getc(&stationary_fairy_magic_percent,f,true)) | |
| 20446 | { | ||
| 20447 | ✗ | return qe_invalid; | |
| 20448 | } | ||
| 20449 | |||
| 20450 | ✗ | if(!p_getc(&blue_potion_hearts,f,true)) | |
| 20451 | { | ||
| 20452 | ✗ | return qe_invalid; | |
| 20453 | } | ||
| 20454 | |||
| 20455 | ✗ | if(!p_getc(&blue_potion_heart_percent,f,true)) | |
| 20456 | { | ||
| 20457 | ✗ | return qe_invalid; | |
| 20458 | } | ||
| 20459 | |||
| 20460 | ✗ | if(!p_getc(&red_potion_hearts,f,true)) | |
| 20461 | { | ||
| 20462 | ✗ | return qe_invalid; | |
| 20463 | } | ||
| 20464 | |||
| 20465 | ✗ | if(!p_getc(&red_potion_heart_percent,f,true)) | |
| 20466 | { | ||
| 20467 | ✗ | return qe_invalid; | |
| 20468 | } | ||
| 20469 | |||
| 20470 | ✗ | if(!p_getc(&blue_potion_magic,f,true)) | |
| 20471 | { | ||
| 20472 | ✗ | return qe_invalid; | |
| 20473 | } | ||
| 20474 | |||
| 20475 | ✗ | if(!p_getc(&blue_potion_magic_percent,f,true)) | |
| 20476 | { | ||
| 20477 | ✗ | return qe_invalid; | |
| 20478 | } | ||
| 20479 | |||
| 20480 | ✗ | if(!p_getc(&red_potion_magic,f,true)) | |
| 20481 | { | ||
| 20482 | ✗ | return qe_invalid; | |
| 20483 | } | ||
| 20484 | |||
| 20485 | ✗ | if(!p_getc(&red_potion_magic_percent,f,true)) | |
| 20486 | { | ||
| 20487 | ✗ | return qe_invalid; | |
| 20488 | } | ||
| 20489 | } | ||
| 20490 | |||
| 20491 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version>6) |
| 20492 | { | ||
| 20493 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_getc(&temp_zinit.subscreen_style,f,true)) |
| 20494 | { | ||
| 20495 | ✗ | return qe_invalid; | |
| 20496 | } | ||
| 20497 | 77 | } | |
| 20498 | |||
| 20499 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version>7) |
| 20500 | { | ||
| 20501 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_getc(&temp_zinit.usecustomsfx,f,true)) |
| 20502 | { | ||
| 20503 | ✗ | return qe_invalid; | |
| 20504 | } | ||
| 20505 | 77 | } | |
| 20506 | |||
| 20507 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version>8) |
| 20508 | { | ||
| 20509 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&temp_zinit.max_rupees,f,true)) |
| 20510 | { | ||
| 20511 | ✗ | return qe_invalid; | |
| 20512 | } | ||
| 20513 | |||
| 20514 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&temp_zinit.max_keys,f,true)) |
| 20515 | { | ||
| 20516 | ✗ | return qe_invalid; | |
| 20517 | } | ||
| 20518 | 77 | } | |
| 20519 | |||
| 20520 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version>16) |
| 20521 | { | ||
| 20522 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_getc(&temp_zinit.gravity,f,true)) |
| 20523 | { | ||
| 20524 | ✗ | return qe_invalid; | |
| 20525 | } | ||
| 20526 | |||
| 20527 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_igetw(&temp_zinit.terminalv,f,true)) |
| 20528 | { | ||
| 20529 | ✗ | return qe_invalid; | |
| 20530 | } | ||
| 20531 | |||
| 20532 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_getc(&temp_zinit.msg_speed,f,true)) |
| 20533 | { | ||
| 20534 | ✗ | return qe_invalid; | |
| 20535 | } | ||
| 20536 | |||
| 20537 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_getc(&temp_zinit.transition_type,f,true)) |
| 20538 | { | ||
| 20539 | ✗ | return qe_invalid; | |
| 20540 | } | ||
| 20541 | |||
| 20542 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_getc(&temp_zinit.jump_hero_layer_threshold,f,true)) |
| 20543 | { | ||
| 20544 | ✗ | return qe_invalid; | |
| 20545 | } | ||
| 20546 | 77 | } | |
| 20547 | |||
| 20548 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version>17) |
| 20549 | { | ||
| 20550 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(!p_getc(&temp_zinit.msg_more_is_offset,f,true)) |
| 20551 | { | ||
| 20552 | ✗ | return qe_invalid; | |
| 20553 | } | ||
| 20554 | 77 | } | |
| 20555 | |||
| 20556 | //expaned init data for larger values in 2.55 | ||
| 20557 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if ( s_version >= 19 ) //expand init data bombs, sbombs, and arrows to 0xFFFF |
| 20558 | { | ||
| 20559 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_igetw(&temp_zinit.bombs,f,true)) |
| 20560 | { | ||
| 20561 | ✗ | return qe_invalid; | |
| 20562 | } | ||
| 20563 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_igetw(&temp_zinit.super_bombs,f,true)) |
| 20564 | { | ||
| 20565 | ✗ | return qe_invalid; | |
| 20566 | } | ||
| 20567 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_igetw(&temp_zinit.max_bombs,f,true)) |
| 20568 | { | ||
| 20569 | ✗ | return qe_invalid; | |
| 20570 | } | ||
| 20571 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_igetw(&temp_zinit.max_sbombs,f,true)) |
| 20572 | { | ||
| 20573 | ✗ | return qe_invalid; | |
| 20574 | } | ||
| 20575 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_igetw(&temp_zinit.arrows,f,true)) |
| 20576 | { | ||
| 20577 | ✗ | return qe_invalid; | |
| 20578 | } | ||
| 20579 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_igetw(&temp_zinit.max_arrows,f,true)) |
| 20580 | { | ||
| 20581 | ✗ | return qe_invalid; | |
| 20582 | } | ||
| 20583 | |||
| 20584 | 8 | } | |
| 20585 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if ( s_version >= 20 ) |
| 20586 | { | ||
| 20587 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_igetw(&temp_zinit.heroStep,f,true)) |
| 20588 | { | ||
| 20589 | ✗ | return qe_invalid; | |
| 20590 | } | ||
| 20591 | 8 | } | |
| 20592 | else | ||
| 20593 | { | ||
| 20594 | 69 | temp_zinit.heroStep = 150; //1.5 pixels per frame | |
| 20595 | } | ||
| 20596 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if ( s_version >= 21 ) |
| 20597 | { | ||
| 20598 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_igetw(&temp_zinit.subscrSpeed,f,true)) |
| 20599 | { | ||
| 20600 | ✗ | return qe_invalid; | |
| 20601 | } | ||
| 20602 | 8 | } | |
| 20603 | else | ||
| 20604 | { | ||
| 20605 | 69 | temp_zinit.subscrSpeed = 1; //3 pixels per frame | |
| 20606 | } | ||
| 20607 | //old only | ||
| 20608 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
77 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 20609 | { | ||
| 20610 | byte items2; | ||
| 20611 | |||
| 20612 | ✗ | if(!p_getc(&items2,f,true)) | |
| 20613 | { | ||
| 20614 | ✗ | return qe_invalid; | |
| 20615 | } | ||
| 20616 | |||
| 20617 | ✗ | temp_zinit.items[iDinsFire]=(get_bit(&items2, idI_DFIRE)!=0); | |
| 20618 | ✗ | temp_zinit.items[iFaroresWind]=(get_bit(&items2, idI_FWIND)!=0); | |
| 20619 | ✗ | temp_zinit.items[iNayrusLove]=(get_bit(&items2, idI_NLOVE)!=0); | |
| 20620 | } | ||
| 20621 | |||
| 20622 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(Header->zelda_version < 0x193) |
| 20623 | { | ||
| 20624 | ✗ | for(int32_t q=0; q<96; q++) | |
| 20625 | { | ||
| 20626 | ✗ | if(!p_getc(&padding,f,true)) | |
| 20627 | { | ||
| 20628 | ✗ | return qe_invalid; | |
| 20629 | } | ||
| 20630 | } | ||
| 20631 | |||
| 20632 | //new only | ||
| 20633 | ✗ | if((Header->zelda_version == 0x192)&&(Header->build>173)) | |
| 20634 | { | ||
| 20635 | ✗ | if(!p_getc(&padding,f,true)) | |
| 20636 | { | ||
| 20637 | ✗ | return qe_invalid; | |
| 20638 | } | ||
| 20639 | |||
| 20640 | ✗ | if(!p_getc(&padding,f,true)) | |
| 20641 | { | ||
| 20642 | ✗ | return qe_invalid; | |
| 20643 | } | ||
| 20644 | } | ||
| 20645 | } | ||
| 20646 | 77 | } | |
| 20647 | |||
| 20648 |
3/6✓ Branch 0 taken 77 times.
✓ Branch 1 taken 61 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
138 | if((Header->zelda_version < 0x211)||((Header->zelda_version == 0x211)&&(Header->build<15))) |
| 20649 | { | ||
| 20650 | //temp_zinit.shield=i_smallshield; | ||
| 20651 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | int32_t sshieldid = getItemID(itemsbuf, itype_shield, i_smallshield); |
| 20652 | |||
| 20653 | ✗ | if(sshieldid != -1) | |
| 20654 | ✗ | temp_zinit.items[sshieldid] = true; | |
| 20655 | } | ||
| 20656 | |||
| 20657 |
2/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<27))) |
| 20658 | { | ||
| 20659 | ✗ | temp_zinit.hc=3; | |
| 20660 | ✗ | temp_zinit.start_heart=3; | |
| 20661 | ✗ | temp_zinit.cont_heart=3; | |
| 20662 | ✗ | temp_zinit.max_bombs=8; | |
| 20663 | } | ||
| 20664 | |||
| 20665 |
2/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<50))) |
| 20666 | { | ||
| 20667 | ✗ | sword_hearts[0]=0; | |
| 20668 | ✗ | sword_hearts[1]=5; | |
| 20669 | ✗ | sword_hearts[2]=12; | |
| 20670 | ✗ | sword_hearts[3]=21; | |
| 20671 | } | ||
| 20672 | |||
| 20673 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<51))) |
| 20674 | { | ||
| 20675 | ✗ | temp_zinit.last_map=0; | |
| 20676 | ✗ | temp_zinit.last_screen=0; | |
| 20677 | } | ||
| 20678 | |||
| 20679 |
2/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<68))) |
| 20680 | { | ||
| 20681 | ✗ | temp_zinit.max_magic=0; | |
| 20682 | ✗ | temp_zinit.magic=0; | |
| 20683 | ✗ | set_bit(temp_zinit.misc,idM_DOUBLEMAGIC,0); | |
| 20684 | } | ||
| 20685 | |||
| 20686 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<129))) |
| 20687 | { | ||
| 20688 | |||
| 20689 | ✗ | for(int32_t x=0; x<4; x++) | |
| 20690 | { | ||
| 20691 | ✗ | beam_hearts[x]=100; | |
| 20692 | } | ||
| 20693 | |||
| 20694 | ✗ | for(int32_t i=0; i<idBP_MAX; i++) | |
| 20695 | { | ||
| 20696 | ✗ | set_bit(&beam_percent,i,!get_bit(quest_rules,qr_LENSHINTS+i)); | |
| 20697 | ✗ | set_bit(quest_rules,qr_LENSHINTS+i,0); | |
| 20698 | } | ||
| 20699 | |||
| 20700 | ✗ | for(int32_t x=0; x<4; x++) | |
| 20701 | { | ||
| 20702 | ✗ | beam_power[x]=get_bit(quest_rules,qr_HIDECARRIEDITEMS)?50:100; | |
| 20703 | } | ||
| 20704 | |||
| 20705 | ✗ | set_bit(quest_rules,qr_HIDECARRIEDITEMS,0); | |
| 20706 | ✗ | hookshot_links=100; | |
| 20707 | ✗ | temp_zinit.msg_more_x=224; | |
| 20708 | ✗ | temp_zinit.msg_more_y=64; | |
| 20709 | } | ||
| 20710 | |||
| 20711 | // Okay, let's put these legacy values into itemsbuf. | ||
| 20712 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(s_version < 15) |
| 20713 | ✗ | for(int32_t i=0; i<MAXITEMS; i++) | |
| 20714 | { | ||
| 20715 | ✗ | switch(i) | |
| 20716 | { | ||
| 20717 | case iFairyStill: | ||
| 20718 | ✗ | itemsbuf[i].misc1 = stationary_fairy_hearts; | |
| 20719 | ✗ | itemsbuf[i].misc2 = stationary_fairy_magic; | |
| 20720 | ✗ | itemsbuf[i].misc3 = 0; | |
| 20721 | ✗ | itemsbuf[i].flags |= stationary_fairy_heart_percent ? ITEM_FLAG1 : 0; | |
| 20722 | ✗ | itemsbuf[i].flags |= stationary_fairy_magic_percent ? ITEM_FLAG2 : 0; | |
| 20723 | ✗ | break; | |
| 20724 | |||
| 20725 | case iFairyMoving: | ||
| 20726 | ✗ | itemsbuf[i].misc1 = moving_fairy_hearts; | |
| 20727 | ✗ | itemsbuf[i].misc2 = moving_fairy_magic; | |
| 20728 | ✗ | itemsbuf[i].misc3 = 50; | |
| 20729 | ✗ | itemsbuf[i].flags |= moving_fairy_heart_percent ? ITEM_FLAG1 : 0; | |
| 20730 | ✗ | itemsbuf[i].flags |= moving_fairy_magic_percent ? ITEM_FLAG2 : 0; | |
| 20731 | ✗ | break; | |
| 20732 | |||
| 20733 | case iRPotion: | ||
| 20734 | ✗ | itemsbuf[i].misc1 = red_potion_hearts; | |
| 20735 | ✗ | itemsbuf[i].misc2 = red_potion_magic; | |
| 20736 | ✗ | itemsbuf[i].flags |= red_potion_heart_percent ? ITEM_FLAG1 : 0; | |
| 20737 | ✗ | itemsbuf[i].flags |= red_potion_magic_percent ? ITEM_FLAG2 : 0; | |
| 20738 | ✗ | break; | |
| 20739 | |||
| 20740 | case iBPotion: | ||
| 20741 | ✗ | itemsbuf[i].misc1 = blue_potion_hearts; | |
| 20742 | ✗ | itemsbuf[i].misc2 = blue_potion_magic; | |
| 20743 | ✗ | itemsbuf[i].flags |= blue_potion_heart_percent ? ITEM_FLAG1 : 0; | |
| 20744 | ✗ | itemsbuf[i].flags |= blue_potion_magic_percent ? ITEM_FLAG2 : 0; | |
| 20745 | ✗ | break; | |
| 20746 | |||
| 20747 | case iSword: | ||
| 20748 | ✗ | itemsbuf[i].pickup_hearts = sword_hearts[0]; | |
| 20749 | ✗ | itemsbuf[i].misc1 = beam_hearts[0]; | |
| 20750 | ✗ | itemsbuf[i].misc2 = beam_power[0]; | |
| 20751 | // It seems that ITEM_FLAG1 was already added by reset_itembuf()... | ||
| 20752 | ✗ | itemsbuf[i].flags &= (!get_bit(&beam_percent,0)) ? ~ITEM_FLAG1 : ~0; | |
| 20753 | ✗ | break; | |
| 20754 | |||
| 20755 | case iWSword: | ||
| 20756 | ✗ | itemsbuf[i].pickup_hearts = sword_hearts[1]; | |
| 20757 | ✗ | itemsbuf[i].misc1 = beam_hearts[1]; | |
| 20758 | ✗ | itemsbuf[i].misc2 = beam_power[1]; | |
| 20759 | ✗ | itemsbuf[i].flags &= (!get_bit(&beam_percent,1)) ? ~ITEM_FLAG1 : ~0; | |
| 20760 | ✗ | break; | |
| 20761 | |||
| 20762 | case iMSword: | ||
| 20763 | ✗ | itemsbuf[i].pickup_hearts = sword_hearts[2]; | |
| 20764 | ✗ | itemsbuf[i].misc1 = beam_hearts[2]; | |
| 20765 | ✗ | itemsbuf[i].misc2 = beam_power[2]; | |
| 20766 | ✗ | itemsbuf[i].flags &= (!get_bit(&beam_percent,2)) ? ~ITEM_FLAG1 : ~0; | |
| 20767 | ✗ | break; | |
| 20768 | |||
| 20769 | case iXSword: | ||
| 20770 | ✗ | itemsbuf[i].pickup_hearts = sword_hearts[3]; | |
| 20771 | ✗ | itemsbuf[i].misc1 = beam_hearts[3]; | |
| 20772 | ✗ | itemsbuf[i].misc2 = beam_power[3]; | |
| 20773 | ✗ | itemsbuf[i].flags &= (!get_bit(&beam_percent,3)) ? ~ITEM_FLAG1 : ~0; | |
| 20774 | ✗ | break; | |
| 20775 | |||
| 20776 | case iHookshot: | ||
| 20777 | ✗ | itemsbuf[i].misc1 = hookshot_length; | |
| 20778 | ✗ | itemsbuf[i].misc2 = hookshot_links; | |
| 20779 | ✗ | break; | |
| 20780 | |||
| 20781 | case iLongshot: | ||
| 20782 | ✗ | itemsbuf[i].misc1 = longshot_length; | |
| 20783 | ✗ | itemsbuf[i].misc2 = longshot_links; | |
| 20784 | ✗ | break; | |
| 20785 | } | ||
| 20786 | } | ||
| 20787 | |||
| 20788 |
2/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<168))) |
| 20789 | { | ||
| 20790 | //was new subscreen rule | ||
| 20791 | ✗ | temp_zinit.subscreen=get_bit(quest_rules,qr_FREEFORM)?1:0; | |
| 20792 | ✗ | set_bit(quest_rules,qr_FREEFORM,0); | |
| 20793 | } | ||
| 20794 | |||
| 20795 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<185))) |
| 20796 | { | ||
| 20797 | ✗ | temp_zinit.start_dmap=0; | |
| 20798 | } | ||
| 20799 | |||
| 20800 |
2/6✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<186))) |
| 20801 | { | ||
| 20802 | ✗ | temp_zinit.heroAnimationStyle=get_bit(quest_rules,qr_BSZELDA)?1:0; | |
| 20803 | } | ||
| 20804 | |||
| 20805 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if(s_version < 16 && get_bit(deprecated_rules, qr_COOLSCROLL+1)) |
| 20806 | { | ||
| 20807 | //addOldStyleFamily(&temp_zinit, itemsbuf, itype_wallet, 4); //is this needed? | ||
| 20808 | ✗ | temp_zinit.max_rupees=999; | |
| 20809 | //temp_zinit.rupies=999; //This rule only gave you an invisible max wallet; it did not give you max rupies. | ||
| 20810 | } | ||
| 20811 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(Header->zelda_version < 0x190) //1.84 bugfix. -Z |
| 20812 | { | ||
| 20813 | //temp_zinit.items[iBombBag] = true; //No, this is 30 max bombs! | ||
| 20814 | ✗ | temp_zinit.max_bombs = 8; | |
| 20815 | } | ||
| 20816 | // al_trace("About to copy over new init data values for quest made in: %x\n", Header->zelda_version); | ||
| 20817 | //time to ensure that we port all new values properly: | ||
| 20818 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(Header->zelda_version < 0x250) |
| 20819 | { | ||
| 20820 | ✗ | temp_zinit.max_sbombs = temp_zinit.bomb_ratio > 0 ? ( temp_zinit.max_bombs/temp_zinit.bomb_ratio ) : (temp_zinit.max_bombs/4); | |
| 20821 | } | ||
| 20822 | |||
| 20823 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(s_version > 21) |
| 20824 | { | ||
| 20825 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_getc(&temp_zinit.hp_per_heart,f,true)) |
| 20826 | { | ||
| 20827 | ✗ | return qe_invalid; | |
| 20828 | } | ||
| 20829 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_getc(&temp_zinit.magic_per_block,f,true)) |
| 20830 | { | ||
| 20831 | ✗ | return qe_invalid; | |
| 20832 | } | ||
| 20833 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_getc(&temp_zinit.hero_damage_multiplier,f,true)) |
| 20834 | { | ||
| 20835 | ✗ | return qe_invalid; | |
| 20836 | } | ||
| 20837 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_getc(&temp_zinit.ene_damage_multiplier,f,true)) |
| 20838 | { | ||
| 20839 | ✗ | return qe_invalid; | |
| 20840 | } | ||
| 20841 | 8 | } | |
| 20842 | else | ||
| 20843 | { | ||
| 20844 | 69 | temp_zinit.hp_per_heart = 16; //HP_PER_HEART, previously hardcoded | |
| 20845 | 69 | temp_zinit.magic_per_block = 32; //MAGICPERBLOCK, previously hardcoded | |
| 20846 | 69 | temp_zinit.hero_damage_multiplier = 2; //DAMAGE_MULTIPLIER, previously hardcoded | |
| 20847 | 69 | temp_zinit.ene_damage_multiplier = 4; //(HP_PER_HEART/4), previously hardcoded | |
| 20848 | } | ||
| 20849 | |||
| 20850 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(s_version > 22) |
| 20851 | { | ||
| 20852 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 8 times.
|
208 | for(int32_t q = 0; q < 25; ++q) |
| 20853 | { | ||
| 20854 |
2/4✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 200 times.
|
200 | if(!p_igetw(&temp_zinit.scrcnt[q],f,true)) |
| 20855 | { | ||
| 20856 | ✗ | return qe_invalid; | |
| 20857 | } | ||
| 20858 | 200 | } | |
| 20859 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 8 times.
|
208 | for(int32_t q = 0; q < 25; ++q) |
| 20860 | { | ||
| 20861 |
2/4✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 200 times.
|
200 | if(!p_igetw(&temp_zinit.scrmaxcnt[q],f,true)) |
| 20862 | { | ||
| 20863 | ✗ | return qe_invalid; | |
| 20864 | } | ||
| 20865 | 200 | } | |
| 20866 | 8 | } | |
| 20867 | else | ||
| 20868 | { | ||
| 20869 |
2/2✓ Branch 0 taken 1725 times.
✓ Branch 1 taken 69 times.
|
1794 | for(int32_t q = 0; q < 25; ++q) |
| 20870 | { | ||
| 20871 | 1725 | temp_zinit.scrcnt[q] = 0; | |
| 20872 | 1725 | temp_zinit.scrmaxcnt[q] = 0; | |
| 20873 | 1725 | } | |
| 20874 | } | ||
| 20875 | |||
| 20876 | |||
| 20877 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(s_version > 23) |
| 20878 | { | ||
| 20879 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_getc(&temp_zinit.dither_type,f,true)) |
| 20880 | { | ||
| 20881 | ✗ | return qe_invalid; | |
| 20882 | } | ||
| 20883 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_getc(&temp_zinit.dither_arg,f,true)) |
| 20884 | { | ||
| 20885 | ✗ | return qe_invalid; | |
| 20886 | } | ||
| 20887 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_getc(&temp_zinit.dither_percent,f,true)) |
| 20888 | { | ||
| 20889 | ✗ | return qe_invalid; | |
| 20890 | } | ||
| 20891 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_getc(&temp_zinit.def_lightrad,f,true)) |
| 20892 | { | ||
| 20893 | ✗ | return qe_invalid; | |
| 20894 | } | ||
| 20895 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_getc(&temp_zinit.transdark_percent,f,true)) |
| 20896 | { | ||
| 20897 | ✗ | return qe_invalid; | |
| 20898 | } | ||
| 20899 | 8 | } | |
| 20900 | else | ||
| 20901 | { | ||
| 20902 | 69 | temp_zinit.dither_type = 0; | |
| 20903 | 69 | temp_zinit.dither_arg = 0; | |
| 20904 | 69 | temp_zinit.dither_percent = 20; | |
| 20905 | 69 | temp_zinit.def_lightrad = 24; | |
| 20906 | 69 | temp_zinit.transdark_percent = 0; | |
| 20907 | } | ||
| 20908 | |||
| 20909 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(s_version > 24) |
| 20910 | { | ||
| 20911 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_getc(&temp_zinit.darkcol,f,true)) |
| 20912 | { | ||
| 20913 | ✗ | return qe_invalid; | |
| 20914 | } | ||
| 20915 | 8 | } | |
| 20916 | else | ||
| 20917 | { | ||
| 20918 | 69 | temp_zinit.darkcol = BLACK; | |
| 20919 | } | ||
| 20920 | |||
| 20921 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(s_version > 25) |
| 20922 | { | ||
| 20923 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_igetl(&temp_zinit.gravity2,f,true)) |
| 20924 | { | ||
| 20925 | ✗ | return qe_invalid; | |
| 20926 | } | ||
| 20927 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_igetl(&temp_zinit.swimgravity,f,true)) |
| 20928 | { | ||
| 20929 | ✗ | return qe_invalid; | |
| 20930 | } | ||
| 20931 | 8 | } | |
| 20932 | else | ||
| 20933 | { | ||
| 20934 | 69 | temp_zinit.gravity2 = temp_zinit.gravity*100; | |
| 20935 | 69 | temp_zinit.swimgravity = 5; | |
| 20936 | } | ||
| 20937 | |||
| 20938 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(s_version > 26) |
| 20939 | { | ||
| 20940 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_igetw(&temp_zinit.heroSideswimUpStep,f,true)) |
| 20941 | { | ||
| 20942 | ✗ | return qe_invalid; | |
| 20943 | } | ||
| 20944 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_igetw(&temp_zinit.heroSideswimSideStep,f,true)) |
| 20945 | { | ||
| 20946 | ✗ | return qe_invalid; | |
| 20947 | } | ||
| 20948 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_igetw(&temp_zinit.heroSideswimDownStep,f,true)) |
| 20949 | { | ||
| 20950 | ✗ | return qe_invalid; | |
| 20951 | } | ||
| 20952 | 8 | } | |
| 20953 | else | ||
| 20954 | { | ||
| 20955 | 69 | temp_zinit.heroSideswimUpStep = 150; | |
| 20956 | 69 | temp_zinit.heroSideswimSideStep = 100; | |
| 20957 | 69 | temp_zinit.heroSideswimDownStep = 75; | |
| 20958 | } | ||
| 20959 | |||
| 20960 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(s_version > 27) |
| 20961 | { | ||
| 20962 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_igetl(&temp_zinit.exitWaterJump,f,true)) |
| 20963 | { | ||
| 20964 | ✗ | return qe_invalid; | |
| 20965 | } | ||
| 20966 | 8 | } | |
| 20967 | else | ||
| 20968 | { | ||
| 20969 | 69 | temp_zinit.exitWaterJump = 0; | |
| 20970 | } | ||
| 20971 | |||
| 20972 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(s_version > 29) |
| 20973 | { | ||
| 20974 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_igetl(&temp_zinit.bunny_ltm,f,true)) |
| 20975 | { | ||
| 20976 | ✗ | return qe_invalid; | |
| 20977 | } | ||
| 20978 | 8 | } | |
| 20979 | else | ||
| 20980 | { | ||
| 20981 | 69 | temp_zinit.bunny_ltm = 0; | |
| 20982 | } | ||
| 20983 | |||
| 20984 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(s_version > 30) |
| 20985 | { | ||
| 20986 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_getc(&temp_zinit.switchhookstyle,f,true)) |
| 20987 | { | ||
| 20988 | ✗ | return qe_invalid; | |
| 20989 | } | ||
| 20990 | 8 | } | |
| 20991 | else | ||
| 20992 | { | ||
| 20993 | 69 | temp_zinit.switchhookstyle = 1; | |
| 20994 | } | ||
| 20995 | |||
| 20996 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 69 times.
|
77 | if(s_version > 31) |
| 20997 | { | ||
| 20998 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(!p_getc(&temp_zinit.magicdrainrate,f,true)) |
| 20999 | { | ||
| 21000 | ✗ | return qe_invalid; | |
| 21001 | } | ||
| 21002 | 8 | } | |
| 21003 | else | ||
| 21004 | { | ||
| 21005 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | temp_zinit.magicdrainrate = (get_bit(temp_zinit.misc,idM_DOUBLEMAGIC) ? 1 : 2); |
| 21006 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | set_bit(temp_zinit.misc,idM_DOUBLEMAGIC,0); |
| 21007 | } | ||
| 21008 | |||
| 21009 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | temp_zinit.clear_genscript(); |
| 21010 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 75 times.
|
77 | if(s_version > 32) |
| 21011 | { | ||
| 21012 | 2 | word numgenscript = 0; | |
| 21013 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | if(!p_igetw(&numgenscript,f,true)) |
| 21014 | ✗ | return qe_invalid; | |
| 21015 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
|
3 | for(auto q = 1; q < numgenscript; ++q) |
| 21016 | { | ||
| 21017 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | if(!p_getc(&padding,f,true)) |
| 21018 | ✗ | return qe_invalid; | |
| 21019 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(!(padding&2)) |
| 21020 | ✗ | continue; | |
| 21021 | 1 | temp_zinit.gen_doscript[q] = padding&1; | |
| 21022 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
1 | if(!p_igetw(&temp_zinit.gen_exitState[q],f,true)) |
| 21023 | ✗ | return qe_invalid; | |
| 21024 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | if(!p_igetw(&temp_zinit.gen_reloadState[q],f,true)) |
| 21025 | ✗ | return qe_invalid; | |
| 21026 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 8 times.
|
9 | for(auto p = 0; p < 8; ++p) |
| 21027 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8 times.
|
8 | if(!p_igetl(&temp_zinit.gen_initd[q][p],f,true)) |
| 21028 | ✗ | return qe_invalid; | |
| 21029 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
1 | if(!p_igetl(&temp_zinit.gen_dataSize[q],f,true)) |
| 21030 | ✗ | return qe_invalid; | |
| 21031 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | if(!p_getlvec<int32_t>(&temp_zinit.gen_data[q],f,true)) |
| 21032 | ✗ | return qe_invalid; | |
| 21033 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
1 | if(!p_igetl(&temp_zinit.gen_eventstate[q],f,true)) |
| 21034 | ✗ | return qe_invalid; | |
| 21035 | 1 | } | |
| 21036 | 2 | } | |
| 21037 | |||
| 21038 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(keepdata==true) |
| 21039 | { | ||
| 21040 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | zinit = temp_zinit; |
| 21041 | |||
| 21042 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(zinit.heroAnimationStyle==las_zelda3slow) |
| 21043 | { | ||
| 21044 | ✗ | hero_animation_speed=2; | |
| 21045 | } | ||
| 21046 | else | ||
| 21047 | { | ||
| 21048 | 77 | hero_animation_speed=1; | |
| 21049 | } | ||
| 21050 | 77 | } | |
| 21051 | |||
| 21052 | 77 | return 0; | |
| 21053 | 353 | } | |
| 21054 | |||
| 21055 | /* | ||
| 21056 | void setupitemdropsets() | ||
| 21057 | { | ||
| 21058 | for(int32_t i=0; i<isMAX; i++) | ||
| 21059 | { | ||
| 21060 | memcpy(&item_drop_sets[i], &default_item_drop_sets[i], sizeof(item_drop_object)); | ||
| 21061 | } | ||
| 21062 | } | ||
| 21063 | */ | ||
| 21064 | |||
| 21065 | 77 | int32_t readitemdropsets(PACKFILE *f, int32_t version, word build, bool keepdata) | |
| 21066 | { | ||
| 21067 | 77 | build=build; // here to prevent compiler warnings | |
| 21068 | dword dummy_dword; | ||
| 21069 | 77 | word item_drop_sets_to_read=0; | |
| 21070 | item_drop_object tempitemdrop; | ||
| 21071 | 77 | word s_version=0, s_cversion=0; | |
| 21072 | |||
| 21073 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(keepdata) |
| 21074 | { | ||
| 21075 |
2/2✓ Branch 0 taken 19712 times.
✓ Branch 1 taken 77 times.
|
19789 | for(int32_t i=0; i<MAXITEMDROPSETS; i++) |
| 21076 | { | ||
| 21077 | 19712 | memset(&item_drop_sets[i], 0, sizeof(item_drop_object)); | |
| 21078 | 19712 | } | |
| 21079 | 77 | } | |
| 21080 | |||
| 21081 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(version > 0x192) |
| 21082 | { | ||
| 21083 | 77 | item_drop_sets_to_read=0; | |
| 21084 | |||
| 21085 | //section version info | ||
| 21086 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_version,f,true)) |
| 21087 | { | ||
| 21088 | ✗ | return qe_invalid; | |
| 21089 | } | ||
| 21090 | |||
| 21091 | 77 | FFCore.quest_format[vItemDropsets] = s_version; | |
| 21092 | |||
| 21093 | //al_trace("Item drop sets version %d\n", s_version); | ||
| 21094 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_cversion,f,true)) |
| 21095 | { | ||
| 21096 | ✗ | return qe_invalid; | |
| 21097 | } | ||
| 21098 | |||
| 21099 | //section size | ||
| 21100 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&dummy_dword,f,true)) |
| 21101 | { | ||
| 21102 | ✗ | return qe_invalid; | |
| 21103 | } | ||
| 21104 | |||
| 21105 | //finally... section data | ||
| 21106 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&item_drop_sets_to_read,f,true)) |
| 21107 | { | ||
| 21108 | ✗ | return qe_invalid; | |
| 21109 | } | ||
| 21110 | 77 | } | |
| 21111 | else | ||
| 21112 | { | ||
| 21113 | ✗ | if(keepdata==true) | |
| 21114 | { | ||
| 21115 | ✗ | init_item_drop_sets(); | |
| 21116 | } | ||
| 21117 | } | ||
| 21118 | |||
| 21119 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(s_version>=1) |
| 21120 | { | ||
| 21121 |
2/2✓ Branch 0 taken 1587 times.
✓ Branch 1 taken 77 times.
|
1664 | for(int32_t i=0; i<item_drop_sets_to_read; i++) |
| 21122 | { | ||
| 21123 |
1/2✓ Branch 0 taken 1587 times.
✗ Branch 1 not taken.
|
1587 | if(!pfread(tempitemdrop.name,sizeof(tempitemdrop.name),f,true)) |
| 21124 | { | ||
| 21125 | ✗ | return qe_invalid; | |
| 21126 | } | ||
| 21127 | |||
| 21128 |
2/2✓ Branch 0 taken 15870 times.
✓ Branch 1 taken 1587 times.
|
17457 | for(int32_t j=0; j<10; ++j) |
| 21129 | { | ||
| 21130 |
1/2✓ Branch 0 taken 15870 times.
✗ Branch 1 not taken.
|
15870 | if(!p_igetw(&tempitemdrop.item[j],f,true)) |
| 21131 | { | ||
| 21132 | ✗ | return qe_invalid; | |
| 21133 | } | ||
| 21134 | 15870 | } | |
| 21135 | |||
| 21136 |
2/2✓ Branch 0 taken 17457 times.
✓ Branch 1 taken 1587 times.
|
19044 | for(int32_t j=0; j<11; ++j) |
| 21137 | { | ||
| 21138 |
1/2✓ Branch 0 taken 17457 times.
✗ Branch 1 not taken.
|
17457 | if(!p_igetw(&tempitemdrop.chance[j],f,true)) |
| 21139 | { | ||
| 21140 | ✗ | return qe_invalid; | |
| 21141 | } | ||
| 21142 | 17457 | } | |
| 21143 | |||
| 21144 | // Dec 2008: Addition of the 'Tall Grass' set, #12, | ||
| 21145 | // overrides the quest's set #12. | ||
| 21146 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1587 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1587 | if(s_version<2 && i==12) |
| 21147 | ✗ | continue; | |
| 21148 | |||
| 21149 | // Deprecated: qr_NOCLOCKS and qr_ALLOW10RUPEEDROPS | ||
| 21150 |
1/4✓ Branch 0 taken 1587 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1587 | if(s_version<2) for(int32_t j=0; j<10; ++j) |
| 21151 | { | ||
| 21152 | ✗ | int32_t it = tempitemdrop.item[j]; | |
| 21153 | |||
| 21154 | ✗ | if((itemsbuf[it].family == itype_rupee | |
| 21155 | ✗ | && ((itemsbuf[it].amount)&0xFFF) == 10) | |
| 21156 | ✗ | && !get_bit(deprecated_rules, qr_ALLOW10RUPEEDROPS_DEP)) | |
| 21157 | { | ||
| 21158 | ✗ | tempitemdrop.chance[j+1]=0; | |
| 21159 | } | ||
| 21160 | ✗ | else if(itemsbuf[it].family == itype_clock && get_bit(deprecated_rules, qr_NOCLOCKS_DEP)) | |
| 21161 | { | ||
| 21162 | ✗ | tempitemdrop.chance[j+1]=0; | |
| 21163 | } | ||
| 21164 | |||
| 21165 | // From Sept 2007 to Dec 2008, non-gameplay items were prohibited. | ||
| 21166 | ✗ | if(itemsbuf[it].family == itype_misc) | |
| 21167 | { | ||
| 21168 | // If a non-gameplay item was selected, then item drop was aborted. | ||
| 21169 | // Reflect this by increasing the 'Nothing' chance accordingly. | ||
| 21170 | ✗ | tempitemdrop.chance[0]+=tempitemdrop.chance[j+1]; | |
| 21171 | ✗ | tempitemdrop.chance[j+1]=0; | |
| 21172 | } | ||
| 21173 | } | ||
| 21174 | |||
| 21175 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1587 times.
|
1587 | if(keepdata) |
| 21176 | { | ||
| 21177 | 1587 | memcpy(&item_drop_sets[i], &tempitemdrop, sizeof(item_drop_object)); | |
| 21178 | 1587 | } | |
| 21179 | 1587 | } | |
| 21180 | 77 | } | |
| 21181 | |||
| 21182 | 77 | return 0; | |
| 21183 | 77 | } | |
| 21184 | |||
| 21185 | 77 | int32_t readfavorites(PACKFILE *f, int32_t, word, bool keepdata) | |
| 21186 | { | ||
| 21187 | int32_t temp_num; | ||
| 21188 | dword dummy_dword; | ||
| 21189 | word num_favorite_combos; | ||
| 21190 | word num_favorite_combo_aliases; | ||
| 21191 | 77 | word s_version=0, s_cversion=0; | |
| 21192 | |||
| 21193 | //section version info | ||
| 21194 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(!p_igetw(&s_version,f,true)) |
| 21195 | { | ||
| 21196 | ✗ | return qe_invalid; | |
| 21197 | } | ||
| 21198 | |||
| 21199 | 77 | FFCore.quest_format[vFavourites] = s_version; | |
| 21200 | |||
| 21201 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&s_cversion,f,true)) |
| 21202 | { | ||
| 21203 | ✗ | return qe_invalid; | |
| 21204 | } | ||
| 21205 | |||
| 21206 | //section size | ||
| 21207 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetl(&dummy_dword,f,true)) |
| 21208 | { | ||
| 21209 | ✗ | return qe_invalid; | |
| 21210 | } | ||
| 21211 | |||
| 21212 | //finally... section data | ||
| 21213 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&num_favorite_combos,f,true)) |
| 21214 | { | ||
| 21215 | ✗ | return qe_invalid; | |
| 21216 | } | ||
| 21217 | |||
| 21218 |
2/2✓ Branch 0 taken 7700 times.
✓ Branch 1 taken 77 times.
|
7777 | for(int32_t i=0; i<num_favorite_combos; i++) |
| 21219 | { | ||
| 21220 |
1/2✓ Branch 0 taken 7700 times.
✗ Branch 1 not taken.
|
7700 | if(!p_igetl(&temp_num,f,true)) |
| 21221 | { | ||
| 21222 | ✗ | return qe_invalid; | |
| 21223 | } | ||
| 21224 | |||
| 21225 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7700 times.
|
7700 | if(keepdata) |
| 21226 | { | ||
| 21227 | 7700 | favorite_combos[i]=temp_num; | |
| 21228 | 7700 | } | |
| 21229 | 7700 | } | |
| 21230 | |||
| 21231 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_igetw(&num_favorite_combo_aliases,f,true)) |
| 21232 | { | ||
| 21233 | ✗ | return qe_invalid; | |
| 21234 | } | ||
| 21235 | |||
| 21236 |
2/2✓ Branch 0 taken 7700 times.
✓ Branch 1 taken 77 times.
|
7777 | for(int32_t i=0; i<num_favorite_combo_aliases; i++) |
| 21237 | { | ||
| 21238 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7700 times.
|
7700 | if(!p_igetl(&temp_num,f,true)) |
| 21239 | { | ||
| 21240 | ✗ | return qe_invalid; | |
| 21241 | } | ||
| 21242 | |||
| 21243 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7700 times.
|
7700 | if(keepdata) |
| 21244 | { | ||
| 21245 | 7700 | favorite_comboaliases[i]=temp_num; | |
| 21246 | 7700 | } | |
| 21247 | 7700 | } | |
| 21248 | |||
| 21249 | 77 | return 0; | |
| 21250 | 77 | } | |
| 21251 | |||
| 21252 | /* | ||
| 21253 | switch (ret) { | ||
| 21254 | case 0: | ||
| 21255 | break; | ||
| 21256 | |||
| 21257 | case qe_invalid: | ||
| 21258 | goto invalid; | ||
| 21259 | break; | ||
| 21260 | default: | ||
| 21261 | pack_fclose(f); | ||
| 21262 | if(!oldquest) | ||
| 21263 | delete_file(tmpfilename); | ||
| 21264 | return ret; | ||
| 21265 | break; | ||
| 21266 | } | ||
| 21267 | */ | ||
| 21268 | |||
| 21269 | const char *skip_text[skip_max]= | ||
| 21270 | { | ||
| 21271 | "skip_header", "skip_rules", "skip_strings", "skip_misc", | ||
| 21272 | "skip_tiles", "skip_combos", "skip_comboaliases", "skip_csets", | ||
| 21273 | "skip_maps", "skip_dmaps", "skip_doors", "skip_items", | ||
| 21274 | "skip_weapons", "skip_colors", "skip_icons", "skip_initdata", | ||
| 21275 | "skip_guys", "skip_herosprites", "skip_subscreens", "skip_ffscript", | ||
| 21276 | "skip_sfx", "skip_midis", "skip_cheats", "skip_itemdropsets", | ||
| 21277 | "skip_favorites" | ||
| 21278 | }; | ||
| 21279 | |||
| 21280 | |||
| 21281 | ✗ | void port250QuestRules(){ | |
| 21282 | |||
| 21283 | ✗ | portCandleRules(); //Candle | |
| 21284 | ✗ | portBombRules(); | |
| 21285 | |||
| 21286 | } | ||
| 21287 | |||
| 21288 | ✗ | void portCandleRules() | |
| 21289 | { | ||
| 21290 | ✗ | bool hurtshero = get_bit(quest_rules,qr_FIREPROOFHERO); | |
| 21291 | //itemdata itemsbuf; | ||
| 21292 | ✗ | for ( int32_t q = 0; q < MAXITEMS; q++ ) | |
| 21293 | { | ||
| 21294 | ✗ | if ( itemsbuf[q].family == itype_candle ) | |
| 21295 | { | ||
| 21296 | ✗ | if ( hurtshero ) itemsbuf[q].flags |= ITEM_FLAG2; | |
| 21297 | ✗ | else itemsbuf[q].flags &= ~ ITEM_FLAG2; | |
| 21298 | } | ||
| 21299 | } | ||
| 21300 | } | ||
| 21301 | |||
| 21302 | ✗ | void portBombRules() | |
| 21303 | { | ||
| 21304 | ✗ | bool hurtshero = get_bit(quest_rules,qr_OUCHBOMBS); | |
| 21305 | //itemdata itemsbuf; | ||
| 21306 | ✗ | for ( int32_t q = 0; q < MAXITEMS; q++ ) | |
| 21307 | { | ||
| 21308 | ✗ | if ( itemsbuf[q].family == itype_bomb ) | |
| 21309 | { | ||
| 21310 | ✗ | if ( hurtshero ) itemsbuf[q].flags |= ITEM_FLAG2; | |
| 21311 | ✗ | else itemsbuf[q].flags &= ~ ITEM_FLAG2; | |
| 21312 | } | ||
| 21313 | } | ||
| 21314 | |||
| 21315 | } | ||
| 21316 | |||
| 21317 | //Internal function for loadquest wrapper | ||
| 21318 | 77 | int32_t _lq_int(const char *filename, zquestheader *Header, miscQdata *Misc, zctune *tunes, bool show_progress, bool compressed, bool encrypted, bool keepall, const byte *skip_flags, byte printmetadata) | |
| 21319 | { | ||
| 21320 | 77 | DMapEditorLastMaptileUsed = 0; | |
| 21321 | 77 | combosread=false; | |
| 21322 | 77 | mapsread=false; | |
| 21323 | 77 | fixffcs=false; | |
| 21324 | |||
| 21325 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if(get_debug()&&(key[KEY_LSHIFT]||key[KEY_RSHIFT])) |
| 21326 | { | ||
| 21327 | ✗ | keepall=false; | |
| 21328 | ✗ | jwin_alert("Load Quest","Data retention disabled.",NULL,NULL,"OK",NULL,13,27,lfont); | |
| 21329 | } | ||
| 21330 | |||
| 21331 | // show_progress=true; | ||
| 21332 | char tmpfilename[L_tmpnam]; | ||
| 21333 | 77 | temp_name(tmpfilename); | |
| 21334 | // char percent_done[30]; | ||
| 21335 | 77 | bool catchup=false; | |
| 21336 | byte tempbyte; | ||
| 21337 | 77 | word old_map_count=map_count; | |
| 21338 | |||
| 21339 | 77 | byte old_quest_rules[QUESTRULES_NEW_SIZE] = {0}; | |
| 21340 | 77 | byte old_extra_rules[EXTRARULES_SIZE] = {0}; | |
| 21341 | 77 | byte old_midi_flags[MIDIFLAGS_SIZE] = {0}; | |
| 21342 | |||
| 21343 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | if(keepall==false||get_bit(skip_flags, skip_rules)) |
| 21344 | { | ||
| 21345 | ✗ | memcpy(old_quest_rules, quest_rules, QUESTRULES_NEW_SIZE); | |
| 21346 | ✗ | memcpy(old_extra_rules, extra_rules, EXTRARULES_SIZE); | |
| 21347 | } | ||
| 21348 | |||
| 21349 | 77 | memset(quest_rules, 0, QUESTRULES_NEW_SIZE); //clear here to prevent any kind of carryover -Z | |
| 21350 | // memset(extra_rules, 0, EXTRARULES_SIZE); //clear here to prevent any kind of carryover -Z | ||
| 21351 | |||
| 21352 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | if(keepall==false||get_bit(skip_flags, skip_midis)) |
| 21353 | { | ||
| 21354 | ✗ | memcpy(old_midi_flags, midi_flags, MIDIFLAGS_SIZE); | |
| 21355 | } | ||
| 21356 | |||
| 21357 | |||
| 21358 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | if(keepall&&!get_bit(skip_flags, skip_ffscript)) |
| 21359 | { | ||
| 21360 | 77 | zScript.clear(); | |
| 21361 | 77 | globalmap.clear(); | |
| 21362 | 77 | genericmap.clear(); | |
| 21363 | 77 | ffcmap.clear(); | |
| 21364 | 77 | itemmap.clear(); | |
| 21365 | 77 | npcmap.clear(); | |
| 21366 | 77 | ewpnmap.clear(); | |
| 21367 | 77 | lwpnmap.clear(); | |
| 21368 | 77 | playermap.clear(); | |
| 21369 | 77 | dmapmap.clear(); | |
| 21370 | 77 | screenmap.clear(); | |
| 21371 | 77 | itemspritemap.clear(); | |
| 21372 | 77 | comboscriptmap.clear(); | |
| 21373 | |||
| 21374 |
2/2✓ Branch 0 taken 39347 times.
✓ Branch 1 taken 77 times.
|
39424 | for(int32_t i=0; i<NUMSCRIPTFFC-1; i++) |
| 21375 | { | ||
| 21376 | 39347 | ffcmap[i].clear(); | |
| 21377 | 39347 | } | |
| 21378 | |||
| 21379 | 77 | globalmap[0].slotname = "Slot 1:"; | |
| 21380 | 77 | globalmap[0].scriptname = "~Init"; | |
| 21381 | 77 | globalmap[0].update(); | |
| 21382 | |||
| 21383 |
2/2✓ Branch 0 taken 539 times.
✓ Branch 1 taken 77 times.
|
616 | for(int32_t i=1; i<NUMSCRIPTGLOBAL; i++) |
| 21384 | { | ||
| 21385 | 539 | globalmap[i].clear(); | |
| 21386 | 539 | } | |
| 21387 | |||
| 21388 |
2/2✓ Branch 0 taken 19635 times.
✓ Branch 1 taken 77 times.
|
19712 | for(int32_t i=0; i<NUMSCRIPTITEM-1; i++) |
| 21389 | { | ||
| 21390 | 19635 | itemmap[i].clear(); | |
| 21391 | 19635 | } | |
| 21392 | |||
| 21393 | //new script types -- prevent carrying over to a quest that you load after reading them | ||
| 21394 | //e.g., a quest has an npc script, and you make a blank quest, that now believes that it has an npc script, too! | ||
| 21395 |
2/2✓ Branch 0 taken 19635 times.
✓ Branch 1 taken 77 times.
|
19712 | for(int32_t i=0; i<NUMSCRIPTGUYS-1; i++) |
| 21396 | { | ||
| 21397 | 19635 | npcmap[i].clear(); | |
| 21398 | 19635 | } | |
| 21399 |
2/2✓ Branch 0 taken 19635 times.
✓ Branch 1 taken 77 times.
|
19712 | for(int32_t i=0; i<NUMSCRIPTWEAPONS-1; i++) |
| 21400 | { | ||
| 21401 | 19635 | lwpnmap[i].clear(); | |
| 21402 | 19635 | } | |
| 21403 |
2/2✓ Branch 0 taken 19635 times.
✓ Branch 1 taken 77 times.
|
19712 | for(int32_t i=0; i<NUMSCRIPTWEAPONS-1; i++) |
| 21404 | { | ||
| 21405 | 19635 | ewpnmap[i].clear(); | |
| 21406 | 19635 | } | |
| 21407 |
2/2✓ Branch 0 taken 308 times.
✓ Branch 1 taken 77 times.
|
385 | for(int32_t i=0; i<NUMSCRIPTPLAYER-1; i++) |
| 21408 | { | ||
| 21409 | 308 | playermap[i].clear(); | |
| 21410 | 308 | } | |
| 21411 |
2/2✓ Branch 0 taken 19635 times.
✓ Branch 1 taken 77 times.
|
19712 | for(int32_t i=0; i<NUMSCRIPTSDMAP-1; i++) |
| 21412 | { | ||
| 21413 | 19635 | dmapmap[i].clear(); | |
| 21414 | 19635 | } | |
| 21415 |
2/2✓ Branch 0 taken 19635 times.
✓ Branch 1 taken 77 times.
|
19712 | for(int32_t i=0; i<NUMSCRIPTSCREEN-1; i++) |
| 21416 | { | ||
| 21417 | 19635 | screenmap[i].clear(); | |
| 21418 | 19635 | } | |
| 21419 |
2/2✓ Branch 0 taken 19635 times.
✓ Branch 1 taken 77 times.
|
19712 | for(int32_t i=0; i<NUMSCRIPTSITEMSPRITE-1; i++) |
| 21420 | { | ||
| 21421 | 19635 | itemspritemap[i].clear(); | |
| 21422 | 19635 | } | |
| 21423 |
2/2✓ Branch 0 taken 39347 times.
✓ Branch 1 taken 77 times.
|
39424 | for(int32_t i=0; i<NUMSCRIPTSCOMBODATA-1; i++) |
| 21424 | { | ||
| 21425 | 39347 | comboscriptmap[i].clear(); | |
| 21426 | 39347 | } | |
| 21427 |
2/2✓ Branch 0 taken 39347 times.
✓ Branch 1 taken 77 times.
|
39424 | for(int32_t i=0; i<NUMSCRIPTSGENERIC-1; i++) |
| 21428 | { | ||
| 21429 | 39347 | genericmap[i].clear(); | |
| 21430 | 39347 | } | |
| 21431 | |||
| 21432 | 77 | reset_scripts(); | |
| 21433 | 77 | } | |
| 21434 | |||
| 21435 | zquestheader tempheader; | ||
| 21436 | 77 | memset(&tempheader, 0, sizeof(zquestheader)); | |
| 21437 | 77 | zinfo tempzi; | |
| 21438 | 77 | tempzi.clear(); | |
| 21439 | 77 | load_tmp_zi = &tempzi; | |
| 21440 | |||
| 21441 | // oldquest flag is set when an unencrypted qst file is suspected. | ||
| 21442 | 77 | bool oldquest = false; | |
| 21443 | 77 | int32_t open_error=0; | |
| 21444 | char deletefilename[1024]; | ||
| 21445 | 77 | PACKFILE *f=open_quest_file(&open_error, filename, deletefilename, compressed, encrypted, show_progress); | |
| 21446 | |||
| 21447 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(!f) |
| 21448 | ✗ | return open_error; | |
| 21449 | char zinfofilename[2048]; | ||
| 21450 | 77 | replace_extension(zinfofilename, filename, "zinfo", 2047); | |
| 21451 | 77 | int32_t ret=0; | |
| 21452 | |||
| 21453 | //header | ||
| 21454 | 77 | box_out("Reading Header..."); | |
| 21455 | 77 | ret=readheader(f, &tempheader, true, printmetadata); | |
| 21456 |
1/5✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21457 | 77 | box_out("okay."); | |
| 21458 | 77 | box_eol(); | |
| 21459 | |||
| 21460 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8 times.
|
77 | if(read_zinfo) |
| 21461 | { | ||
| 21462 | 8 | box_out("Reading ZInfo - "); | |
| 21463 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 7 times.
|
8 | box_out(read_ext_zinfo ? "External..." : "Internal..."); |
| 21464 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 7 times.
|
8 | if(read_ext_zinfo) |
| 21465 | { | ||
| 21466 | 1 | PACKFILE *inf=pack_fopen_password(zinfofilename, F_READ, ""); | |
| 21467 | 1 | ret=readzinfo(inf, tempzi, tempheader); | |
| 21468 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(inf) pack_fclose(inf); |
| 21469 |
1/5✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
1 | checkstatus(ret); |
| 21470 | 1 | } | |
| 21471 | else | ||
| 21472 | { | ||
| 21473 | 7 | ret=readzinfo(f, tempzi, tempheader); | |
| 21474 |
1/5✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
7 | checkstatus(ret); |
| 21475 | } | ||
| 21476 | 8 | box_out("okay."); | |
| 21477 | 8 | box_eol(); | |
| 21478 | 8 | } | |
| 21479 | |||
| 21480 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(tempheader.zelda_version>=0x193) |
| 21481 | { | ||
| 21482 | dword section_id; | ||
| 21483 | |||
| 21484 | //section id | ||
| 21485 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(!p_mgetl(§ion_id,f,true)) |
| 21486 | { | ||
| 21487 | ✗ | return qe_invalid; | |
| 21488 | } | ||
| 21489 | |||
| 21490 |
2/2✓ Branch 0 taken 1848 times.
✓ Branch 1 taken 77 times.
|
1925 | while(!pack_feof(f)) |
| 21491 | { | ||
| 21492 |
24/25✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
✓ Branch 2 taken 77 times.
✓ Branch 3 taken 77 times.
✓ Branch 4 taken 77 times.
✓ Branch 5 taken 77 times.
✓ Branch 6 taken 77 times.
✓ Branch 7 taken 77 times.
✓ Branch 8 taken 77 times.
✓ Branch 9 taken 77 times.
✓ Branch 10 taken 77 times.
✓ Branch 11 taken 77 times.
✓ Branch 12 taken 77 times.
✓ Branch 13 taken 77 times.
✓ Branch 14 taken 77 times.
✓ Branch 15 taken 77 times.
✓ Branch 16 taken 77 times.
✓ Branch 17 taken 77 times.
✓ Branch 18 taken 77 times.
✓ Branch 19 taken 77 times.
✓ Branch 20 taken 77 times.
✓ Branch 21 taken 77 times.
✓ Branch 22 taken 77 times.
✓ Branch 23 taken 77 times.
✓ Branch 24 taken 77 times.
|
1848 | switch(section_id) |
| 21493 | { | ||
| 21494 | case ID_RULES: | ||
| 21495 | |||
| 21496 | //rules | ||
| 21497 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21498 | { | ||
| 21499 | ✗ | box_out("found."); | |
| 21500 | ✗ | box_eol(); | |
| 21501 | ✗ | catchup=false; | |
| 21502 | } | ||
| 21503 | |||
| 21504 | 77 | box_out("Reading Rules..."); | |
| 21505 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readrules(f, &tempheader, keepall&&!get_bit(skip_flags, skip_rules)); |
| 21506 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21507 | 77 | box_out("okay."); | |
| 21508 | 77 | box_eol(); | |
| 21509 | 77 | break; | |
| 21510 | |||
| 21511 | case ID_STRINGS: | ||
| 21512 | |||
| 21513 | //strings | ||
| 21514 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21515 | { | ||
| 21516 | ✗ | box_out("found."); | |
| 21517 | ✗ | box_eol(); | |
| 21518 | ✗ | catchup=false; | |
| 21519 | } | ||
| 21520 | |||
| 21521 | 77 | box_out("Reading Strings..."); | |
| 21522 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readstrings(f, &tempheader, keepall&&!get_bit(skip_flags, skip_strings)); |
| 21523 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21524 | 77 | box_out("okay."); | |
| 21525 | 77 | box_eol(); | |
| 21526 | 77 | break; | |
| 21527 | |||
| 21528 | case ID_MISC: | ||
| 21529 | |||
| 21530 | //misc data | ||
| 21531 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21532 | { | ||
| 21533 | ✗ | box_out("found."); | |
| 21534 | ✗ | box_eol(); | |
| 21535 | ✗ | catchup=false; | |
| 21536 | } | ||
| 21537 | |||
| 21538 | 77 | box_out("Reading Misc. Data..."); | |
| 21539 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readmisc(f, &tempheader, Misc, keepall&&!get_bit(skip_flags, skip_misc)); |
| 21540 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21541 | 77 | box_out("okay."); | |
| 21542 | 77 | box_eol(); | |
| 21543 | 77 | break; | |
| 21544 | |||
| 21545 | case ID_TILES: | ||
| 21546 | |||
| 21547 | //tiles | ||
| 21548 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21549 | { | ||
| 21550 | ✗ | box_out("found."); | |
| 21551 | ✗ | box_eol(); | |
| 21552 | ✗ | catchup=false; | |
| 21553 | } | ||
| 21554 | |||
| 21555 | 77 | box_out("Reading Tiles..."); | |
| 21556 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readtiles(f, newtilebuf, &tempheader, tempheader.zelda_version, tempheader.build, 0, NEWMAXTILES, false, keepall&&!get_bit(skip_flags, skip_tiles)); |
| 21557 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21558 | 77 | box_out("okay."); | |
| 21559 | 77 | box_eol(); | |
| 21560 | 77 | break; | |
| 21561 | |||
| 21562 | case ID_COMBOS: | ||
| 21563 | |||
| 21564 | //combos | ||
| 21565 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21566 | { | ||
| 21567 | ✗ | box_out("found."); | |
| 21568 | ✗ | box_eol(); | |
| 21569 | ✗ | catchup=false; | |
| 21570 | } | ||
| 21571 | |||
| 21572 | 77 | box_out("Reading Combos..."); | |
| 21573 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readcombos(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXCOMBOS, keepall&&!get_bit(skip_flags, skip_combos)); |
| 21574 | 77 | combosread=true; | |
| 21575 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21576 | 77 | box_out("okay."); | |
| 21577 | 77 | box_eol(); | |
| 21578 | 77 | break; | |
| 21579 | |||
| 21580 | case ID_COMBOALIASES: | ||
| 21581 | |||
| 21582 | //combo aliases | ||
| 21583 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21584 | { | ||
| 21585 | ✗ | box_out("found."); | |
| 21586 | ✗ | box_eol(); | |
| 21587 | ✗ | catchup=false; | |
| 21588 | } | ||
| 21589 | |||
| 21590 | 77 | box_out("Reading Combo Aliases..."); | |
| 21591 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readcomboaliases(f, &tempheader, tempheader.zelda_version, tempheader.build, keepall&&!get_bit(skip_flags, skip_comboaliases)); |
| 21592 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21593 | 77 | box_out("okay."); | |
| 21594 | 77 | box_eol(); | |
| 21595 | 77 | break; | |
| 21596 | |||
| 21597 | case ID_CSETS: | ||
| 21598 | |||
| 21599 | //color data | ||
| 21600 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21601 | { | ||
| 21602 | ✗ | box_out("found."); | |
| 21603 | ✗ | box_eol(); | |
| 21604 | ✗ | catchup=false; | |
| 21605 | } | ||
| 21606 | |||
| 21607 | 77 | box_out("Reading Color Data..."); | |
| 21608 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readcolordata(f, Misc, tempheader.zelda_version, tempheader.build, 0, newerpdTOTAL, keepall&&!get_bit(skip_flags, skip_csets)); |
| 21609 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21610 | 77 | box_out("okay."); | |
| 21611 | 77 | box_eol(); | |
| 21612 | 77 | break; | |
| 21613 | |||
| 21614 | case ID_MAPS: | ||
| 21615 | |||
| 21616 | //maps | ||
| 21617 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21618 | { | ||
| 21619 | ✗ | box_out("found."); | |
| 21620 | ✗ | box_eol(); | |
| 21621 | ✗ | catchup=false; | |
| 21622 | } | ||
| 21623 | |||
| 21624 | 77 | box_out("Reading Maps..."); | |
| 21625 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readmaps(f, &tempheader, keepall&&!get_bit(skip_flags, skip_maps)); |
| 21626 | 77 | mapsread=true; | |
| 21627 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21628 | 77 | box_out("okay."); | |
| 21629 | 77 | box_eol(); | |
| 21630 | 77 | break; | |
| 21631 | |||
| 21632 | case ID_DMAPS: | ||
| 21633 | |||
| 21634 | //dmaps | ||
| 21635 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21636 | { | ||
| 21637 | ✗ | box_out("found."); | |
| 21638 | ✗ | box_eol(); | |
| 21639 | ✗ | catchup=false; | |
| 21640 | } | ||
| 21641 | |||
| 21642 | 77 | box_out("Reading DMaps..."); | |
| 21643 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readdmaps(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXDMAPS, keepall&&!get_bit(skip_flags, skip_dmaps)); |
| 21644 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21645 | 77 | box_out("okay."); | |
| 21646 | 77 | box_eol(); | |
| 21647 | 77 | break; | |
| 21648 | |||
| 21649 | case ID_DOORS: | ||
| 21650 | |||
| 21651 | //door combo sets | ||
| 21652 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21653 | { | ||
| 21654 | ✗ | box_out("found."); | |
| 21655 | ✗ | box_eol(); | |
| 21656 | ✗ | catchup=false; | |
| 21657 | } | ||
| 21658 | |||
| 21659 | 77 | box_out("Reading Doors..."); | |
| 21660 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readdoorcombosets(f, &tempheader, keepall&&!get_bit(skip_flags, skip_doors)); |
| 21661 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21662 | 77 | box_out("okay."); | |
| 21663 | 77 | box_eol(); | |
| 21664 | 77 | break; | |
| 21665 | |||
| 21666 | case ID_ITEMS: | ||
| 21667 | |||
| 21668 | //items | ||
| 21669 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21670 | { | ||
| 21671 | ✗ | box_out("found."); | |
| 21672 | ✗ | box_eol(); | |
| 21673 | ✗ | catchup=false; | |
| 21674 | } | ||
| 21675 | |||
| 21676 | 77 | box_out("Reading Items..."); | |
| 21677 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readitems(f, tempheader.zelda_version, tempheader.build, keepall&&!get_bit(skip_flags, skip_items)); |
| 21678 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21679 | |||
| 21680 | 77 | box_out("okay."); | |
| 21681 | 77 | box_eol(); | |
| 21682 | 77 | break; | |
| 21683 | |||
| 21684 | case ID_WEAPONS: | ||
| 21685 | |||
| 21686 | //weapons | ||
| 21687 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21688 | { | ||
| 21689 | ✗ | box_out("found."); | |
| 21690 | ✗ | box_eol(); | |
| 21691 | ✗ | catchup=false; | |
| 21692 | } | ||
| 21693 | |||
| 21694 | 77 | box_out("Reading Weapons..."); | |
| 21695 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readweapons(f, &tempheader, keepall&&!get_bit(skip_flags, skip_weapons)); |
| 21696 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21697 | 77 | box_out("okay."); | |
| 21698 | 77 | box_eol(); | |
| 21699 | 77 | break; | |
| 21700 | |||
| 21701 | case ID_COLORS: | ||
| 21702 | |||
| 21703 | //misc. colors | ||
| 21704 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21705 | { | ||
| 21706 | ✗ | box_out("found."); | |
| 21707 | ✗ | box_eol(); | |
| 21708 | ✗ | catchup=false; | |
| 21709 | } | ||
| 21710 | |||
| 21711 | 77 | box_out("Reading Misc. Colors..."); | |
| 21712 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readmisccolors(f, &tempheader, Misc, keepall&&!get_bit(skip_flags, skip_colors)); |
| 21713 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21714 | 77 | box_out("okay."); | |
| 21715 | 77 | box_eol(); | |
| 21716 | 77 | break; | |
| 21717 | |||
| 21718 | case ID_ICONS: | ||
| 21719 | |||
| 21720 | //game icons | ||
| 21721 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21722 | { | ||
| 21723 | ✗ | box_out("found."); | |
| 21724 | ✗ | box_eol(); | |
| 21725 | ✗ | catchup=false; | |
| 21726 | } | ||
| 21727 | |||
| 21728 | 77 | box_out("Reading Game Icons..."); | |
| 21729 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readgameicons(f, &tempheader, Misc, keepall&&!get_bit(skip_flags, skip_icons)); |
| 21730 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21731 | 77 | box_out("okay."); | |
| 21732 | 77 | box_eol(); | |
| 21733 | 77 | break; | |
| 21734 | |||
| 21735 | case ID_INITDATA: | ||
| 21736 | |||
| 21737 | //initialization data | ||
| 21738 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21739 | { | ||
| 21740 | ✗ | box_out("found."); | |
| 21741 | ✗ | box_eol(); | |
| 21742 | ✗ | catchup=false; | |
| 21743 | } | ||
| 21744 | |||
| 21745 | 77 | box_out("Reading Init. Data..."); | |
| 21746 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readinitdata(f, &tempheader, keepall&&!get_bit(skip_flags, skip_initdata)); |
| 21747 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21748 | 77 | box_out("okay."); | |
| 21749 | 77 | box_eol(); | |
| 21750 | |||
| 21751 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | if(keepall&&!get_bit(skip_flags, skip_subscreens)) |
| 21752 | { | ||
| 21753 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 13 times.
|
77 | if(zinit.subscreen!=ssdtMAX) //not using custom subscreens |
| 21754 | { | ||
| 21755 | 13 | setupsubscreens(); | |
| 21756 | |||
| 21757 |
2/2✓ Branch 0 taken 6656 times.
✓ Branch 1 taken 13 times.
|
6669 | for(int32_t i=0; i<MAXDMAPS; ++i) |
| 21758 | { | ||
| 21759 | 6656 | int32_t type=DMaps[i].type&dmfTYPE; | |
| 21760 |
2/2✓ Branch 0 taken 13 times.
✓ Branch 1 taken 6643 times.
|
6656 | DMaps[i].active_subscreen=(type == dmOVERW || type == dmBSOVERW)?0:1; |
| 21761 | 6656 | DMaps[i].passive_subscreen=(get_bit(quest_rules,qr_ENABLEMAGIC))?0:1; | |
| 21762 | 6656 | } | |
| 21763 | 13 | } | |
| 21764 | 77 | } | |
| 21765 | |||
| 21766 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | if(keepall&&!get_bit(skip_flags, skip_sfx)) |
| 21767 | { | ||
| 21768 | 77 | setupsfx(); | |
| 21769 | 77 | } | |
| 21770 | |||
| 21771 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | if(keepall&&!get_bit(skip_flags, skip_itemdropsets)) |
| 21772 | { | ||
| 21773 | 77 | init_item_drop_sets(); | |
| 21774 | 77 | } | |
| 21775 | |||
| 21776 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | if(keepall&&!get_bit(skip_flags, skip_favorites)) |
| 21777 | { | ||
| 21778 | 77 | init_favorites(); | |
| 21779 | 77 | } | |
| 21780 | |||
| 21781 | 77 | break; | |
| 21782 | |||
| 21783 | case ID_GUYS: | ||
| 21784 | |||
| 21785 | //guys | ||
| 21786 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21787 | { | ||
| 21788 | ✗ | box_out("found."); | |
| 21789 | ✗ | box_eol(); | |
| 21790 | ✗ | catchup=false; | |
| 21791 | } | ||
| 21792 | |||
| 21793 | 77 | box_out("Reading Custom Guy Data..."); | |
| 21794 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readguys(f, &tempheader, keepall&&!get_bit(skip_flags, skip_guys)); |
| 21795 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21796 | 77 | box_out("okay."); | |
| 21797 | 77 | box_eol(); | |
| 21798 | 77 | break; | |
| 21799 | |||
| 21800 | case ID_HEROSPRITES: | ||
| 21801 | |||
| 21802 | //player sprites | ||
| 21803 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21804 | { | ||
| 21805 | ✗ | box_out("found."); | |
| 21806 | ✗ | box_eol(); | |
| 21807 | ✗ | catchup=false; | |
| 21808 | } | ||
| 21809 | |||
| 21810 | 77 | box_out("Reading Custom Player Sprite Data..."); | |
| 21811 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readherosprites(f, &tempheader, keepall&&!get_bit(skip_flags, skip_herosprites)); |
| 21812 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21813 | 77 | box_out("okay."); | |
| 21814 | 77 | box_eol(); | |
| 21815 | 77 | break; | |
| 21816 | |||
| 21817 | case ID_SUBSCREEN: | ||
| 21818 | |||
| 21819 | //custom subscreens | ||
| 21820 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21821 | { | ||
| 21822 | ✗ | box_out("found."); | |
| 21823 | ✗ | box_eol(); | |
| 21824 | ✗ | catchup=false; | |
| 21825 | } | ||
| 21826 | |||
| 21827 | 77 | box_out("Reading Custom Subscreen Data..."); | |
| 21828 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readsubscreens(f, &tempheader, keepall&&!get_bit(skip_flags, skip_subscreens)); |
| 21829 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21830 | 77 | box_out("okay."); | |
| 21831 | 77 | box_eol(); | |
| 21832 | 77 | break; | |
| 21833 | |||
| 21834 | case ID_FFSCRIPT: | ||
| 21835 | |||
| 21836 | //Freeform combo scripts | ||
| 21837 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21838 | { | ||
| 21839 | ✗ | box_out("found."); | |
| 21840 | ✗ | box_eol(); | |
| 21841 | ✗ | catchup=false; | |
| 21842 | } | ||
| 21843 | |||
| 21844 | 77 | box_out("Reading FF Script Data..."); | |
| 21845 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readffscript(f, &tempheader, keepall&&!get_bit(skip_flags, skip_ffscript)); |
| 21846 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21847 | 77 | box_out("okay."); | |
| 21848 | 77 | box_eol(); | |
| 21849 | 77 | break; | |
| 21850 | |||
| 21851 | case ID_SFX: | ||
| 21852 | |||
| 21853 | //SFX data | ||
| 21854 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21855 | { | ||
| 21856 | ✗ | box_out("found."); | |
| 21857 | ✗ | box_eol(); | |
| 21858 | ✗ | catchup=false; | |
| 21859 | } | ||
| 21860 | |||
| 21861 | 77 | box_out("Reading SFX Data..."); | |
| 21862 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readsfx(f, &tempheader, keepall&&!get_bit(skip_flags, skip_sfx)); |
| 21863 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21864 | 77 | box_out("okay."); | |
| 21865 | 77 | box_eol(); | |
| 21866 | 77 | break; | |
| 21867 | |||
| 21868 | case ID_MIDIS: | ||
| 21869 | |||
| 21870 | //midis | ||
| 21871 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21872 | { | ||
| 21873 | ✗ | box_out("found."); | |
| 21874 | ✗ | box_eol(); | |
| 21875 | ✗ | catchup=false; | |
| 21876 | } | ||
| 21877 | |||
| 21878 | 77 | box_out("Reading Tunes..."); | |
| 21879 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readtunes(f, &tempheader, tunes, keepall&&!get_bit(skip_flags, skip_midis)); |
| 21880 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21881 | 77 | box_out("okay."); | |
| 21882 | 77 | box_eol(); | |
| 21883 | 77 | break; | |
| 21884 | |||
| 21885 | case ID_CHEATS: | ||
| 21886 | |||
| 21887 | //cheat codes | ||
| 21888 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21889 | { | ||
| 21890 | ✗ | box_out("found."); | |
| 21891 | ✗ | box_eol(); | |
| 21892 | ✗ | catchup=false; | |
| 21893 | } | ||
| 21894 | |||
| 21895 | 77 | box_out("Reading Cheat Codes..."); | |
| 21896 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readcheatcodes(f, &tempheader, keepall&&!get_bit(skip_flags, skip_cheats)); |
| 21897 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21898 | 77 | box_out("okay."); | |
| 21899 | 77 | box_eol(); | |
| 21900 | 77 | break; | |
| 21901 | |||
| 21902 | case ID_ITEMDROPSETS: | ||
| 21903 | |||
| 21904 | //item drop sets | ||
| 21905 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21906 | { | ||
| 21907 | ✗ | box_out("found."); | |
| 21908 | ✗ | box_eol(); | |
| 21909 | ✗ | catchup=false; | |
| 21910 | } | ||
| 21911 | |||
| 21912 | 77 | box_out("Reading Item Drop Sets..."); | |
| 21913 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readitemdropsets(f, tempheader.zelda_version, tempheader.build, keepall&&!get_bit(skip_flags, skip_itemdropsets)); |
| 21914 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21915 | 77 | box_out("okay."); | |
| 21916 | 77 | box_eol(); | |
| 21917 | 77 | break; | |
| 21918 | |||
| 21919 | case ID_FAVORITES: | ||
| 21920 | |||
| 21921 | //favorite combos and combo aliases | ||
| 21922 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(catchup) |
| 21923 | { | ||
| 21924 | ✗ | box_out("found."); | |
| 21925 | ✗ | box_eol(); | |
| 21926 | ✗ | catchup=false; | |
| 21927 | } | ||
| 21928 | |||
| 21929 | 77 | box_out("Reading Favorite Combos..."); | |
| 21930 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | ret=readfavorites(f, tempheader.zelda_version, tempheader.build, keepall&&!get_bit(skip_flags, skip_favorites)); |
| 21931 |
1/5✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
77 | checkstatus(ret); |
| 21932 | 77 | box_out("okay."); | |
| 21933 | 77 | box_eol(); | |
| 21934 | 77 | break; | |
| 21935 | |||
| 21936 | default: | ||
| 21937 | ✗ | if(!catchup) | |
| 21938 | { | ||
| 21939 | ✗ | box_out("Bad token! Searching..."); | |
| 21940 | ✗ | box_eol(); | |
| 21941 | } | ||
| 21942 | |||
| 21943 | ✗ | catchup=true; | |
| 21944 | ✗ | break; | |
| 21945 | } | ||
| 21946 | |||
| 21947 | |||
| 21948 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1848 times.
|
1848 | if(catchup) |
| 21949 | { | ||
| 21950 | //section id | ||
| 21951 | ✗ | section_id=(section_id<<8); | |
| 21952 | |||
| 21953 | ✗ | if(!p_getc(&tempbyte,f,true)) | |
| 21954 | { | ||
| 21955 | ✗ | return qe_invalid; | |
| 21956 | } | ||
| 21957 | |||
| 21958 | ✗ | section_id+=tempbyte; | |
| 21959 | } | ||
| 21960 | |||
| 21961 | else | ||
| 21962 | { | ||
| 21963 | //section id | ||
| 21964 |
2/2✓ Branch 0 taken 77 times.
✓ Branch 1 taken 1771 times.
|
1848 | if(!pack_feof(f)) |
| 21965 | { | ||
| 21966 |
1/2✓ Branch 0 taken 1771 times.
✗ Branch 1 not taken.
|
1771 | if(!p_mgetl(§ion_id,f,true)) |
| 21967 | { | ||
| 21968 | ✗ | return qe_invalid; | |
| 21969 | } | ||
| 21970 | 1771 | } | |
| 21971 | } | ||
| 21972 | } | ||
| 21973 | 77 | } | |
| 21974 | else | ||
| 21975 | { | ||
| 21976 | //rules | ||
| 21977 | ✗ | box_out("Reading Rules..."); | |
| 21978 | ✗ | ret=readrules(f, &tempheader, keepall&&!get_bit(skip_flags, skip_rules)); | |
| 21979 | ✗ | checkstatus(ret); | |
| 21980 | ✗ | box_out("okay."); | |
| 21981 | ✗ | box_eol(); | |
| 21982 | |||
| 21983 | //strings | ||
| 21984 | ✗ | box_out("Reading Strings..."); | |
| 21985 | ✗ | ret=readstrings(f, &tempheader, keepall&&!get_bit(skip_flags, skip_strings)); | |
| 21986 | ✗ | checkstatus(ret); | |
| 21987 | ✗ | box_out("okay."); | |
| 21988 | ✗ | box_eol(); | |
| 21989 | |||
| 21990 | //door combo sets | ||
| 21991 | ✗ | box_out("Reading Doors..."); | |
| 21992 | ✗ | ret=readdoorcombosets(f, &tempheader, keepall&&!get_bit(skip_flags, skip_doors)); | |
| 21993 | ✗ | checkstatus(ret); | |
| 21994 | ✗ | box_out("okay."); | |
| 21995 | ✗ | box_eol(); | |
| 21996 | |||
| 21997 | //dmaps | ||
| 21998 | ✗ | box_out("Reading DMaps..."); | |
| 21999 | ✗ | ret=readdmaps(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXDMAPS, keepall&&!get_bit(skip_flags, skip_dmaps)); | |
| 22000 | ✗ | checkstatus(ret); | |
| 22001 | ✗ | box_out("okay."); | |
| 22002 | ✗ | box_eol(); | |
| 22003 | |||
| 22004 | // misc data | ||
| 22005 | ✗ | box_out("Reading Misc. Data..."); | |
| 22006 | ✗ | ret=readmisc(f, &tempheader, Misc, keepall&&!get_bit(skip_flags, skip_misc)); | |
| 22007 | ✗ | checkstatus(ret); | |
| 22008 | ✗ | box_out("okay."); | |
| 22009 | ✗ | box_eol(); | |
| 22010 | |||
| 22011 | //items | ||
| 22012 | ✗ | box_out("Reading Items..."); | |
| 22013 | ✗ | ret=readitems(f, tempheader.zelda_version, tempheader.build, keepall&&!get_bit(skip_flags, skip_items)); | |
| 22014 | ✗ | checkstatus(ret); | |
| 22015 | ✗ | box_out("okay."); | |
| 22016 | ✗ | box_eol(); | |
| 22017 | |||
| 22018 | //weapons | ||
| 22019 | ✗ | box_out("Reading Weapons..."); | |
| 22020 | ✗ | ret=readweapons(f, &tempheader, keepall&&!get_bit(skip_flags, skip_weapons)); | |
| 22021 | ✗ | checkstatus(ret); | |
| 22022 | ✗ | box_out("okay."); | |
| 22023 | ✗ | box_eol(); | |
| 22024 | |||
| 22025 | //guys | ||
| 22026 | ✗ | box_out("Reading Custom Guy Data..."); | |
| 22027 | ✗ | ret=readguys(f, &tempheader, keepall&&!get_bit(skip_flags, skip_guys)); | |
| 22028 | ✗ | checkstatus(ret); | |
| 22029 | ✗ | box_out("okay."); | |
| 22030 | ✗ | box_eol(); | |
| 22031 | |||
| 22032 | //maps | ||
| 22033 | ✗ | box_out("Reading Maps..."); | |
| 22034 | ✗ | ret=readmaps(f, &tempheader, keepall&&!get_bit(skip_flags, skip_maps)); | |
| 22035 | ✗ | mapsread=true; | |
| 22036 | ✗ | checkstatus(ret); | |
| 22037 | ✗ | box_out("okay."); | |
| 22038 | ✗ | box_eol(); | |
| 22039 | |||
| 22040 | //combos | ||
| 22041 | ✗ | box_out("Reading Combos..."); | |
| 22042 | ✗ | ret=readcombos(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXCOMBOS, keepall&&!get_bit(skip_flags, skip_combos)); | |
| 22043 | ✗ | combosread=true; | |
| 22044 | ✗ | checkstatus(ret); | |
| 22045 | ✗ | box_out("okay."); | |
| 22046 | ✗ | box_eol(); | |
| 22047 | |||
| 22048 | //color data | ||
| 22049 | ✗ | box_out("Reading Color Data..."); | |
| 22050 | ✗ | ret=readcolordata(f, Misc, tempheader.zelda_version, tempheader.build, 0, newerpdTOTAL, keepall&&!get_bit(skip_flags, skip_csets)); | |
| 22051 | ✗ | checkstatus(ret); | |
| 22052 | ✗ | box_out("okay."); | |
| 22053 | ✗ | box_eol(); | |
| 22054 | |||
| 22055 | //tiles | ||
| 22056 | ✗ | box_out("Reading Tiles..."); | |
| 22057 | ✗ | ret=readtiles(f, newtilebuf, &tempheader, tempheader.zelda_version, tempheader.build, 0, NEWMAXTILES, false, keepall&&!get_bit(skip_flags, skip_tiles)); | |
| 22058 | ✗ | checkstatus(ret); | |
| 22059 | ✗ | box_out("okay."); | |
| 22060 | ✗ | box_eol(); | |
| 22061 | |||
| 22062 | //midis | ||
| 22063 | ✗ | box_out("Reading Tunes..."); | |
| 22064 | ✗ | ret=readtunes(f, &tempheader, tunes, keepall&&!get_bit(skip_flags, skip_midis)); | |
| 22065 | ✗ | checkstatus(ret); | |
| 22066 | ✗ | box_out("okay."); | |
| 22067 | ✗ | box_eol(); | |
| 22068 | |||
| 22069 | //cheat codes | ||
| 22070 | ✗ | box_out("Reading Cheat Codes..."); | |
| 22071 | ✗ | ret=readcheatcodes(f, &tempheader, keepall&&!get_bit(skip_flags, skip_cheats)); | |
| 22072 | ✗ | checkstatus(ret); | |
| 22073 | ✗ | box_out("okay."); | |
| 22074 | ✗ | box_eol(); | |
| 22075 | |||
| 22076 | //initialization data | ||
| 22077 | ✗ | box_out("Reading Init. Data..."); | |
| 22078 | ✗ | ret=readinitdata(f, &tempheader, keepall&&!get_bit(skip_flags, skip_initdata)); | |
| 22079 | ✗ | checkstatus(ret); | |
| 22080 | ✗ | box_out("okay."); | |
| 22081 | ✗ | box_eol(); | |
| 22082 | |||
| 22083 | ✗ | if(keepall&&!get_bit(skip_flags, skip_subscreens)) | |
| 22084 | { | ||
| 22085 | ✗ | setupsubscreens(); | |
| 22086 | |||
| 22087 | ✗ | for(int32_t i=0; i<MAXDMAPS; ++i) | |
| 22088 | { | ||
| 22089 | ✗ | int32_t type=DMaps[i].type&dmfTYPE; | |
| 22090 | ✗ | DMaps[i].active_subscreen=(type == dmOVERW || type == dmBSOVERW)?0:1; | |
| 22091 | ✗ | DMaps[i].passive_subscreen=(get_bit(quest_rules,qr_ENABLEMAGIC))?0:1; | |
| 22092 | } | ||
| 22093 | } | ||
| 22094 | |||
| 22095 | ✗ | box_out("Setting Up Default Sound Effects..."); | |
| 22096 | |||
| 22097 | ✗ | if(keepall&&!get_bit(skip_flags, skip_sfx)) | |
| 22098 | ✗ | setupsfx(); | |
| 22099 | |||
| 22100 | ✗ | box_out("okay."); | |
| 22101 | ✗ | box_eol(); | |
| 22102 | |||
| 22103 | //player sprites | ||
| 22104 | ✗ | box_out("Reading Custom Player Sprite Data..."); | |
| 22105 | ✗ | ret=readherosprites2(f, -1, 0, keepall&&!get_bit(skip_flags, skip_herosprites)); | |
| 22106 | ✗ | checkstatus(ret); | |
| 22107 | ✗ | box_out("okay."); | |
| 22108 | ✗ | box_eol(); | |
| 22109 | |||
| 22110 | ✗ | box_out("Setting Up Default Item Drop Sets..."); | |
| 22111 | ✗ | ret=readitemdropsets(f, -1, 0, keepall&&!get_bit(skip_flags, skip_itemdropsets)); | |
| 22112 | ✗ | box_out("okay."); | |
| 22113 | ✗ | box_eol(); | |
| 22114 | } | ||
| 22115 | |||
| 22116 | 77 | init_spritelists(); | |
| 22117 | |||
| 22118 | // check data | ||
| 22119 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(f) |
| 22120 | { | ||
| 22121 | 77 | pack_fclose(f); | |
| 22122 | 77 | } | |
| 22123 | |||
| 22124 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
|
77 | if(!oldquest) |
| 22125 | { | ||
| 22126 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if(exists(tmpfilename)) |
| 22127 | { | ||
| 22128 | ✗ | delete_file(tmpfilename); | |
| 22129 | } | ||
| 22130 | 77 | } | |
| 22131 | |||
| 22132 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
77 | if(fixffcs && combosread && mapsread) |
| 22133 | { | ||
| 22134 | ✗ | for(int32_t i=0; i<map_count; i++) | |
| 22135 | { | ||
| 22136 | ✗ | for(int32_t j=0; j<MAPSCRS; j++) | |
| 22137 | { | ||
| 22138 | ✗ | for(int32_t m=0; m<32; m++) | |
| 22139 | { | ||
| 22140 | ✗ | if(combobuf[TheMaps[(i*MAPSCRS)+j].ffcs[m].getData()].type == cCHANGE) | |
| 22141 | ✗ | TheMaps[(i*MAPSCRS)+j].ffcs[m].flags|=ffCHANGER; | |
| 22142 | } | ||
| 22143 | } | ||
| 22144 | } | ||
| 22145 | } | ||
| 22146 | |||
| 22147 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 18 times.
|
77 | if(get_bit(quest_rules, qr_CONTFULL_DEP)) |
| 22148 | { | ||
| 22149 | 18 | set_bit(quest_rules, qr_CONTFULL_DEP, 0); | |
| 22150 | 18 | set_bit(zinit.misc, idM_CONTPERCENT, 1); | |
| 22151 | 18 | zinit.cont_heart=100; | |
| 22152 | 18 | zinit.start_heart=zinit.hc; | |
| 22153 | 18 | } | |
| 22154 | |||
| 22155 | 77 | box_out("Done."); | |
| 22156 | 77 | box_eol(); | |
| 22157 | 77 | box_end(false); | |
| 22158 | |||
| 22159 | // if (keepall==true||!get_bit(skip_flags, skip_header)) | ||
| 22160 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | if(keepall&&!get_bit(skip_flags, skip_header)) |
| 22161 | { | ||
| 22162 | 77 | memcpy(Header, &tempheader, sizeof(tempheader)); | |
| 22163 | 77 | } | |
| 22164 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | if(keepall&&!get_bit(skip_flags, skip_zinfo)) |
| 22165 | { | ||
| 22166 | 77 | ZI.copyFrom(tempzi); | |
| 22167 | 77 | } | |
| 22168 | |||
| 22169 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | if(!keepall||get_bit(skip_flags, skip_maps)) |
| 22170 | { | ||
| 22171 | ✗ | map_count=old_map_count; | |
| 22172 | } | ||
| 22173 | |||
| 22174 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | if(!keepall||get_bit(skip_flags, skip_rules)) |
| 22175 | { | ||
| 22176 | ✗ | memcpy(quest_rules, old_quest_rules, QUESTRULES_NEW_SIZE); | |
| 22177 | ✗ | memcpy(extra_rules, old_extra_rules, EXTRARULES_SIZE); | |
| 22178 | } | ||
| 22179 | |||
| 22180 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | if(!keepall||get_bit(skip_flags, skip_midis)) |
| 22181 | { | ||
| 22182 | ✗ | memcpy(midi_flags, old_midi_flags, MIDIFLAGS_SIZE); | |
| 22183 | } | ||
| 22184 | |||
| 22185 |
2/4✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
77 | if(deletefilename[0] && exists(deletefilename)) |
| 22186 | { | ||
| 22187 | 77 | delete_file(deletefilename); | |
| 22188 | 77 | } | |
| 22189 | |||
| 22190 | //Debug FFCore.quest_format[] | ||
| 22191 | 77 | al_trace("Quest made in ZC Version: %x\n", FFCore.quest_format[vZelda]); | |
| 22192 | 77 | al_trace("Quest made in ZC Build: %d\n", FFCore.quest_format[vBuild]); | |
| 22193 | 77 | al_trace("Quest Section 'Header' is Version: %d\n", FFCore.quest_format[vHeader]); | |
| 22194 | 77 | al_trace("Quest Section 'Rules' is Version: %d\n", FFCore.quest_format[vRules]); | |
| 22195 | 77 | al_trace("Quest Section 'Strings' is Version: %d\n", FFCore.quest_format[vStrings]); | |
| 22196 | 77 | al_trace("Quest Section 'Misc' is Version: %d\n", FFCore.quest_format[vMisc]); | |
| 22197 | 77 | al_trace("Quest Section 'Tiles' is Version: %d\n", FFCore.quest_format[vTiles]); | |
| 22198 | 77 | al_trace("Quest Section 'Combos' is Version: %d\n", FFCore.quest_format[vCombos]); | |
| 22199 | 77 | al_trace("Quest Section 'CSets' is Version: %d\n", FFCore.quest_format[vCSets]); | |
| 22200 | 77 | al_trace("Quest Section 'Maps' is Version: %d\n", FFCore.quest_format[vMaps]); | |
| 22201 | 77 | al_trace("Quest Section 'DMaps' is Version: %d\n", FFCore.quest_format[vDMaps]); | |
| 22202 | 77 | al_trace("Quest Section 'Doors' is Version: %d\n", FFCore.quest_format[vDoors]); | |
| 22203 | 77 | al_trace("Quest Section 'Items' is Version: %d\n", FFCore.quest_format[vItems]); | |
| 22204 | 77 | al_trace("Quest Section 'Weapons' is Version: %d\n", FFCore.quest_format[vWeaponSprites]); | |
| 22205 | 77 | al_trace("Quest Section 'Colors' is Version: %d\n", FFCore.quest_format[vColours]); | |
| 22206 | 77 | al_trace("Quest Section 'Icons' is Version: %d\n", FFCore.quest_format[vIcons]); | |
| 22207 | //al_trace("Quest Section 'Gfx Pack' is Version: %d; qst.cpp doesn't read this!\n", FFCore.quest_format[vGfxPack]); | ||
| 22208 | 77 | al_trace("Quest Section 'InitData' is Version: %d\n", FFCore.quest_format[vInitData]); | |
| 22209 | 77 | al_trace("Quest Section 'Guys' is Version: %d\n", FFCore.quest_format[vGuys]); | |
| 22210 | 77 | al_trace("Quest Section 'MIDIs' is Version: %d\n", FFCore.quest_format[vMIDIs]); | |
| 22211 | 77 | al_trace("Quest Section 'Cheats' is Version: %d\n", FFCore.quest_format[vCheats]); | |
| 22212 | //al_trace("Quest Section 'Save Format' is Version: %d; qst.cpp doesn't read this!\n", FFCore.quest_format[vSaveformat]); | ||
| 22213 | 77 | al_trace("Quest Section 'Combo Aliases' is Version: %d\n", FFCore.quest_format[vComboAliases]); | |
| 22214 | 77 | al_trace("Quest Section 'Player Sprites' is Version: %d\n", FFCore.quest_format[vHeroSprites]); | |
| 22215 | 77 | al_trace("Quest Section 'Subscreen' is Version: %d\n", FFCore.quest_format[vSubscreen]); | |
| 22216 | 77 | al_trace("Quest Section 'Dropsets' is Version: %d\n", FFCore.quest_format[vItemDropsets]); | |
| 22217 | 77 | al_trace("Quest Section 'FFScript' is Version: %d\n", FFCore.quest_format[vFFScript]); | |
| 22218 | 77 | al_trace("Quest Section 'SFX' is Version: %d\n", FFCore.quest_format[vSFX]); | |
| 22219 | 77 | al_trace("Quest Section 'Favorites' is Version: %d\n", FFCore.quest_format[vFavourites]); | |
| 22220 | 77 | al_trace("Quest Section 'CompatRules' is Version: %d\n", FFCore.quest_format[vCompatRule]); | |
| 22221 | //Print metadata for versions under 2.10 here. Bleah. | ||
| 22222 |
1/2✓ Branch 0 taken 77 times.
✗ Branch 1 not taken.
|
77 | if( FFCore.quest_format[vZelda] < 0x210 ) |
| 22223 | { | ||
| 22224 | ✗ | zprint2("\n[ZQUEST CREATOR METADATA]\n"); | |
| 22225 | |||
| 22226 | ✗ | switch(FFCore.quest_format[vZelda]) | |
| 22227 | { | ||
| 22228 | case 0x193: | ||
| 22229 | { | ||
| 22230 | ✗ | zprint2("Last saved in ZC Editor Version: 1.93, Beta %d\n", FFCore.quest_format[vBuild]); break; | |
| 22231 | } | ||
| 22232 | case 0x192: | ||
| 22233 | { | ||
| 22234 | ✗ | zprint2("Last saved in ZC Editor Version: 1.92, Beta %d\n", FFCore.quest_format[vBuild]); break; | |
| 22235 | } | ||
| 22236 | case 0x190: | ||
| 22237 | { | ||
| 22238 | ✗ | zprint2("Last saved in ZC Editor Version: 1.90"); | |
| 22239 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22240 | ✗ | else zprint2("\n"); | |
| 22241 | ✗ | break; | |
| 22242 | } | ||
| 22243 | case 0x188: | ||
| 22244 | { | ||
| 22245 | ✗ | zprint2("Last saved in ZC Editor Version: 1.88"); | |
| 22246 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22247 | ✗ | else zprint2("\n"); | |
| 22248 | ✗ | break; | |
| 22249 | } | ||
| 22250 | case 0x187: | ||
| 22251 | { | ||
| 22252 | ✗ | zprint2("Last saved in ZC Editor Version: 1.87"); | |
| 22253 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22254 | ✗ | else zprint2("\n"); | |
| 22255 | ✗ | break; | |
| 22256 | } | ||
| 22257 | case 0x186: | ||
| 22258 | { | ||
| 22259 | ✗ | zprint2("Last saved in ZC Editor Version: 1.86"); | |
| 22260 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22261 | ✗ | else zprint2("\n"); | |
| 22262 | ✗ | break; | |
| 22263 | } | ||
| 22264 | case 0x185: | ||
| 22265 | { | ||
| 22266 | ✗ | zprint2("Last saved in ZC Editor Version: 1.85"); | |
| 22267 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22268 | ✗ | else zprint2("\n"); | |
| 22269 | ✗ | break; | |
| 22270 | } | ||
| 22271 | case 0x184: | ||
| 22272 | { | ||
| 22273 | ✗ | zprint2("Last saved in ZC Editor Version: 1.84"); | |
| 22274 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22275 | ✗ | else zprint2("\n"); | |
| 22276 | ✗ | break; | |
| 22277 | } | ||
| 22278 | case 0x183: | ||
| 22279 | { | ||
| 22280 | ✗ | zprint2("Last saved in ZC Editor Version: 1.83"); | |
| 22281 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22282 | ✗ | else zprint2("\n"); | |
| 22283 | ✗ | break; | |
| 22284 | } | ||
| 22285 | case 0x182: | ||
| 22286 | { | ||
| 22287 | ✗ | zprint2("Last saved in ZC Editor Version: 1.82"); | |
| 22288 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22289 | ✗ | else zprint2("\n"); | |
| 22290 | ✗ | break; | |
| 22291 | } | ||
| 22292 | case 0x181: | ||
| 22293 | { | ||
| 22294 | ✗ | zprint2("Last saved in ZC Editor Version: 1.81"); | |
| 22295 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22296 | ✗ | else zprint2("\n"); | |
| 22297 | ✗ | break; | |
| 22298 | } | ||
| 22299 | case 0x180: | ||
| 22300 | { | ||
| 22301 | ✗ | zprint2("Last saved in ZC Editor Version: 1.80"); | |
| 22302 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22303 | ✗ | else zprint2("\n"); | |
| 22304 | ✗ | break; | |
| 22305 | } | ||
| 22306 | default: | ||
| 22307 | { | ||
| 22308 | ✗ | zprint2("Last saved in ZC Editor Version: %x, Beta %d\n", FFCore.quest_format[vZelda],FFCore.quest_format[vBuild]); break; | |
| 22309 | } | ||
| 22310 | } | ||
| 22311 | } | ||
| 22312 | |||
| 22313 | 77 | return qe_OK; | |
| 22314 | |||
| 22315 | invalid: | ||
| 22316 | ✗ | box_out("error."); | |
| 22317 | ✗ | box_eol(); | |
| 22318 | ✗ | box_end(true); | |
| 22319 | |||
| 22320 | ✗ | if(f) | |
| 22321 | { | ||
| 22322 | ✗ | pack_fclose(f); | |
| 22323 | } | ||
| 22324 | |||
| 22325 | ✗ | if(!oldquest) | |
| 22326 | { | ||
| 22327 | ✗ | if(exists(tmpfilename)) | |
| 22328 | { | ||
| 22329 | ✗ | delete_file(tmpfilename); | |
| 22330 | } | ||
| 22331 | |||
| 22332 | ✗ | if(deletefilename[0] && exists(deletefilename)) | |
| 22333 | { | ||
| 22334 | ✗ | delete_file(deletefilename); | |
| 22335 | } | ||
| 22336 | } | ||
| 22337 | |||
| 22338 | ✗ | return qe_invalid; | |
| 22339 | |||
| 22340 | 77 | } | |
| 22341 | |||
| 22342 | 77 | int32_t loadquest(const char *filename, zquestheader *Header, miscQdata *Misc, zctune *tunes, bool show_progress, bool compressed, bool encrypted, bool keepall, byte *skip_flags, byte printmetadata, bool report, byte qst_num) | |
| 22343 | { | ||
| 22344 | 77 | loading_qst_name = filename; | |
| 22345 | 77 | loading_qst_num = qst_num; | |
| 22346 | 77 | loadquest_report = report; | |
| 22347 | 77 | int32_t ret = _lq_int(filename, Header, Misc, tunes, show_progress, compressed, encrypted, keepall, skip_flags,printmetadata); | |
| 22348 | 77 | load_tmp_zi = NULL; | |
| 22349 | 77 | loading_qst_name = NULL; | |
| 22350 | 77 | loadquest_report = false; | |
| 22351 | 77 | loading_qst_num = 0; | |
| 22352 | 77 | return ret; | |
| 22353 | } | ||
| 22354 | /*** end of qst.cc ***/ | ||
| 22355 | |||
| 22356 |